3 # Processes the XSEDE tools config file to turn variables listed in the
4 # file into exported variables in the environment.
6 # Author: Chris Koeritz
10 # this processes the single file of input parameters at the test root and
11 # turns it into a collection of environment variables. we then load all those
12 # variables into the current environment. we will also automatically fill in
13 # some important variables here that we'll use later. in some cases, we will
14 # use the existing value if the variable is already set.
15 define_and_export_variables()
17 if [ -z "$TESTKIT_SENTINEL" ]; then echo Please run prepare_tools.sh before testing.; return 3; fi
19 # create our output folder so we can store logs and temporaries.
20 mkdir -p "$TEST_TEMP" &>/dev/null
22 # start writing the environment file.
23 echo > $TEST_TEMP/env_file
25 # turn each useful line in input file into an environment variable declaration.
27 # match lines that are comments or blank.
28 echo "$line" | grep -e '^[#;]' -e '^[ ]*$' &>/dev/null
29 # only export non-useless lines.
31 echo "$line" | grep '[a-z0-9A-Z]=(' &>/dev/null
33 # it's an array variable so don't try to export it or bash loses it for us.
34 echo $line >> $TEST_TEMP/env_file
36 echo "export" $line >> $TEST_TEMP/env_file
39 done < "$TESTKIT_CFG_FILE"
41 # now run the environment file to add those settings to our environment.
42 chmod +x $TEST_TEMP/env_file
43 source $TEST_TEMP/env_file &>/dev/null