Home Corporate Contacts

TETware Knowledgebase




Return to Knowledgebase Index

32. How to run test cases in a clean environment



We want to be able to run test cases without being influenced by the environment that is in effect when tcc is invoked.



You can use a shellscript exec tool to execute the test case in a pristine environment. The tool must take care not to remove TETware communication variables from the environment, otherwise the TCM/API will be unable to function correctly.

For example:

# exec tool which executes a test case in a known, pristine environment


exec env - \
	${TZ+TZ="$TZ"} \
	./$tcname $*

When a process is executed by the env(1) command with the - option, it is necessary to pass all the required environment variables explicitly on the command line. Other variables which are inherited by the exec tool from tcc and/or tccd are not made available to the test case.

The ${ variable+ word} syntax is used to avoid passing an empty variable to the test case if the corresponding variable was not defined in the parent environment.

On some systems you may need to add other variables to the list. For example: HOME and LOGNAME; variables that might be needed by a dynamic linking scheme such as LD_LIBRARY_PATH, LIBPATH or SHLIB_PATH; anything to do with locales; and so forth. Be sure to include SystemRoot on a Win32 system, otherwise the Windows Socket library won't work.


See also

  • "Communication variables'' in the TETware Programmers Guide.


Home Contacts Legal Copyright Corporate News

Copyright © The Open Group 1995-2012, All Rights Reserved