RADE |
C++ Unit Test Manager |
Writing Shell Dos and Don'tsRules and advice to write test program shells |
Quick Reference |
This table summarized rules and advice to write portable test program shells
![]() |
Reason |
---|---|
![]() | |
![]()
#!/bin/ksh |
Do not start your shell by this instruction, this is usual with Unix but doesn't work with Windows |
![]() |
|
![]()
return 0 |
This instruction may not work with Windows. |
![]()
exit 0 |
|
![]()
diff $ADL_ODT_TMP/MyOutput $ADL_ODT_REF/MyRef >/dev/null |
The /dev/null directory doesn't exist
with Windows, use ADL_ODT_NULL instead. |
![]()
diff $ADL_ODT_TMP/MyOutput ADL_ODT_NULL |
|
![]()
export DICO=/users/cga/myws/FW/Data.d |
Do not use full paths to reference test data,
use WSROOT instead (consult our predefined variables). |
![]()
export DICO=$WSROOT/FW/Data.d |
|
![]()
MYMODULE >$ADL_ODT_TMP/out |
Clearly we have to check a program output only if it has returned the expected code. |
![]()
MYMODULE |
|
![]() xport INPUT=../InputData/ODT.in |
Do not use relative paths since you don't know what is the current working directory. |
![]()
export INPUT=$ADL_ODT_IN/ODT.in |
|
![]()
MODULE >/tmp/MyOutput |
Use ADL_ODT_TMP instead because it
has been set to the right value regarding the current operating system. |
![]()
MODULE >$ADL_ODT_TMP/MyOutput |
|
![]()
OS/MODULE |
Do not reference the path to the program you want to run. "PATH" and "LIBPATH" are automatically set. |
![]() MODULE |
|
![]() export PATH=OS:$PATH |
Do not set neither "PATH" nor "LIBPATH" variables, they are already - and correctly - set. |
![]() |
|
![]()
if [[ "$VAR" = "VAL" ]] ; |
Do not use double square brackets, they are not supported with Windows platforms. |
![]()
if [ "$VAR" = "VAL" ] ; |
|
![]()
X=$WSROOT/FW1/Data.d:WSROOT/FW2/Data.d |
';' and ':' have not the same meaning whether your shell is running on Unix or Windows platforms. Use MK_SEPARATOR instead. |
![]()
X=MK_SEPARATOR$WSROOT/FW2/Data |
|
![]()
Mymodule & |
Our mechanism needs to track processes and it will be difficult it they run in background. |
![]()
Mymodule |
|
![]()
Don't use in the same shell-script export AND chcatenv commands to
modify your CNEXT environment variable. |
Our mechanism needs to track processes and it will be difficult it they run in background. |
![]()
Use ONLY the export command. |
[Top]
Version: 1 [May 2000] | Document created |
[Top] |
Copyright © 2000, Dassault Systèmes. All rights reserved.