From: Frédéric Delanoy Subject: cmd/tests: Add README doc file Message-Id: <1314785559-8119-1-git-send-email-frederic.delanoy@gmail.com> Date: Wed, 31 Aug 2011 12:12:39 +0200 --- programs/cmd/tests/README | 120 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 120 insertions(+), 0 deletions(-) create mode 100644 programs/cmd/tests/README diff --git a/programs/cmd/tests/README b/programs/cmd/tests/README new file mode 100644 index 0000000..dd23964 --- /dev/null +++ b/programs/cmd/tests/README @@ -0,0 +1,120 @@ +CMD TEST PROCEDURE +------------------ + +1. INTRODUCTION + +cmd tests are handled a bit differently than other wine tests. + +The tests are not written in C, but directly in the form of batch files, which +are processed by wine cmd, then compared line by line to an associated expected +result file. + +Currently, we do the equivalent of + + cmd /c test_builtins.cmd == test_builtins.cmd.exp + + +2. ADDING TESTS + +Find the relevant test section ('--- Testing foo ---'), or create it if +necessary. +Enter the code to be processed in the .cmd file, and the expected result in the +associated .exp file. +You might have to use some special keywords. + + +3. KEYWORDS HANDLING + +Both the .cmd and .exp files can contain some keywords, that are expanded or +treated specially at runtime. + +Only @space@ and @tab@ are usable in .cmd files. + +3.1 Spacing Characters + +@space@ +@tab@ + +Replaced by a single space and tab character respectively. +@space@ should generally only be used for trailing spaces, where they can be +difficult to spot. +@tab@ should always be used instead of regular tab characters. + +3.2 Environment + +Following keywords are relevant to the test environment in general: + +@drive@ initial drive letter + +@pwd@ initial working directory + +@path@ initial non-expanded path + +@shortpath@ initial expanded path with short names + +3.3 Test helpers + +@todo_wine@ + +Used at the start of an expected line to indicate a current failure on wine, so +the test suite can run successfully. +To be removed when the test eventually succeeds. + +@or_broken@ + +Used to specify alternate/broken values returned by different windows versions +(e.g. when a specific feature isn't available, etc.) +Can be specified multiple times. +Test runner ignores the remainder of the line following the first @or_broken@ +(keyword included). + +See wine developers guide - testing section for more information + +3.4. Usage Example + +@todo_wine@expected val@space@@or_broken@foo @tab@bar@or_broken@baz + +specifies +- a failure on wine (@todo_wine@) +- normal value is 'expected value ' +- other windows versions can return 'foo \tbar' +- still other windows versions can return 'baz' + + +4. REMARKS / TIPS & TRICKS + +4.1. Error Messages + +Don't try to match error messages: they are language/locale specific and won't +work on all (multilingual) windows versions. + +Ex: don't do + +echo foo_expr -> foo_val@or_broken@Echo is OFF + +but + +echo 'foo_expr' -> 'foo_val'@or_broken@'' + +4.2. Temporary files + +If you need temporary batch/data files, don't add them to git, but create them +at runtime, e.g. using "echo foo>>tmpFile", and delete them afterwards. + +The best way is generally to use names like foo, bar or baz, or even better a +"mkdir foobar & cd foobar" at start and "cd .. & rd /s/q foobar" at the end of +your tests, if appropriate. + +4.2. Processed File + +The result file (processed .cmd file) and error file are deleted after usage. +If you want to check its contents, you can temporarily comment/delete the lines + +DeleteFileA("test.out"); +DeleteFileA("test.err"); + +in programs/cmd/tests/batch.c + +-- +Frédéric Delanoy +frederic.delanoy@gmail.com -- 1.7.6