3 # Supports the TestKit with a few handy functions and many variables.
5 # Author: Chris Koeritz
9 # pull in the really basic functions...
10 source "$TESTKIT_ROOT/library/helper_methods.sh"
14 # this check should be called first, in oneTimeSetUp, in every test script that uses shunit.
15 # it will make sure that important facts are true about the test environment.
17 #hmmm: need to extend this to allow them to add their own sanity checks to it,
18 # similarly to how we need to add log parsing capability as an extension.
20 function sanity_test_and_init()
22 if [ -z "$WORKDIR" ]; then
23 echo "The WORKDIR variable is not set. This should be established by each test, near the top."
26 # establish this for shunit so tests do not have to run in current directory.
27 export SHUNIT_PARENT="$WORKDIR/$(basename "$0")"
29 #hmmm: add other checks here, including the user provided ones.
36 # this is the main source of parameters for the tests.
37 export TESTKIT_CFG_FILE
38 if [ ! -f "$TESTKIT_CFG_FILE" ]; then
39 # well, no config file variable defined, so we go with our default.
40 # this file must exist or we're stumped.
41 TESTKIT_CFG_FILE="$TESTKIT_ROOT/testkit.config"
43 if [ ! -f "$TESTKIT_CFG_FILE" -a -z "$BADNESS" ]; then
45 echo "This script requires that you prepare a customized file in:"
46 echo " $TESTKIT_CFG_FILE"
47 echo " (above is current value of TESTKIT_CFG_FILE variable)"
48 echo "with the details of your testing configuration."
49 echo "There are some example config files in the folder:"
50 echo " $TESTKIT_ROOT/examples"
56 # make sure we aren't premature in processing the config file.
57 if [ -z "$TESTKIT_BOOTSTRAPPING" ]; then
59 # read the config file and generate environment variables for all the entries.
60 source "$TESTKIT_ROOT/library/process_configuration.sh"
61 define_and_export_variables
62 check_if_failed "Not all variables could be imported properly from the configuration file '$TESTKIT_CFG_FILE'"
68 # announce status if in debugging mode.
70 if [ ! -z "$DEBUGGING" -a -z "$SHOWED_SETTINGS_ALREADY" ]; then
71 echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
72 echo TestKit running from: $TESTKIT_ROOT
73 echo TestKit config file: $TESTKIT_CFG_FILE
74 echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
79 # more steps we're not ready for if still bootstrapping our environment.
80 if [ -z "$TESTKIT_BOOTSTRAPPING" ]; then
81 # try to not blast out the above block of info again during this run.
82 export SHOWED_SETTINGS_ALREADY=true
84 # now that we have the environment set up, we can pull in all the functions
85 # we use for running the tests...
86 source "$TESTKIT_ROOT/library/runner_functions.sh"
87 source "$TESTKIT_ROOT/library/random_ids_manager.sh"
88 #hmmm: random ids are not used yet, are they? are they working?
89 source "$TESTKIT_ROOT/library/file_management.sh"