Mercurial > hg > mercurial-crew-with-dirclash
comparison tests/README @ 3098:fe9b13e35e46
Merge with crew
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 15 Sep 2006 15:22:45 -0500 |
parents | f63667f694de |
children | 096f1c73cdc3 |
comparison
equal
deleted
inserted
replaced
3097:1b738357bba9 | 3098:fe9b13e35e46 |
---|---|
29 - diff will show the current time | 29 - diff will show the current time |
30 | 30 |
31 use hg diff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ | 31 use hg diff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ |
32 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" | 32 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" |
33 to strip dates | 33 to strip dates |
34 | |
35 - You can append your own hgrc settings to the file that the environment | |
36 variable HGRCPATH points to. This file is cleared before running a test. | |
37 | |
38 You also need to be careful that the tests are portable from one platform | |
39 to another. You're probably working on Linux, where the GNU toolchain has | |
40 more (or different) functionality than on MacOS, *BSD, Solaris, AIX, etc. | |
41 While testing on all platforms is the only sure-fire way to make sure that | |
42 you've written portable code, here's a list of problems that have been | |
43 found and fixed in the tests. Another, more comprehensive list may be | |
44 found in the GNU Autoconf manual, online here: | |
45 | |
46 http://www.gnu.org/software/autoconf/manual/html_node/Portable-Shell.html | |
47 | |
48 sh: | |
49 | |
50 The Bourne shell is a very basic shell. /bin/sh on Linux is typically | |
51 bash, which even in Bourne-shell mode has many features that Bourne shells | |
52 on other Unix systems don't have (and even on Linux /bin/sh isn't | |
53 guaranteed to be bash). You'll need to be careful about constructs that | |
54 seem ubiquitous, but are actually not available in the least common | |
55 denominator. While using another shell (ksh, bash explicitly, posix shell, | |
56 etc.) explicitly may seem like another option, these may not exist in a | |
57 portable location, and so are generally probably not a good idea. You may | |
58 find that rewriting the test in python will be easier. | |
59 | |
60 - don't use pushd/popd; save the output of "pwd" and use "cd" in place of | |
61 the pushd, and cd back to the saved pwd instead of popd. | |
62 | |
63 - don't use math expressions like let, (( ... )), or $(( ... )); use "expr" | |
64 instead. | |
65 | |
66 grep: | |
67 | |
68 - don't use the -q option; redirect stdout to /dev/null instead. | |
69 | |
70 - don't use extended regular expressions with grep; use egrep instead, and | |
71 don't escape any regex operators. | |
72 | |
73 sed: | |
74 | |
75 - make sure that the beginning-of-line matcher ("^") is at the very | |
76 beginning of the expression -- it may not be supported inside parens. | |
77 | |
78 echo: | |
79 | |
80 - echo may interpret "\n" and print a newline; use printf instead if you | |
81 want a literal "\n" (backslash + n). | |
82 | |
83 false: | |
84 | |
85 - false is guaranteed only to return a non-zero value; you cannot depend on | |
86 it being 1. On Solaris in particular, /bin/false returns 255. Rewrite | |
87 your test to not depend on a particular return value, or create a | |
88 temporary "false" executable, and call that instead. | |
89 | |
90 diff: | |
91 | |
92 - don't use the -N option. There's no particularly good workaround short | |
93 of writing a reasonably complicated replacement script, but substituting | |
94 gdiff for diff if you can't rewrite the test not to need -N will probably | |
95 do. |