avocado-framework/avocado — pull request #128 by ruda (2014-08-05 00:14:53+00:00)
Title: avocado.test: export environment variables to tests.

Export environment variables to the running test.
Really effective when using drop-in tests, that can make use of shell
variables "AVOCADO_*".

Example:

Export variable AVOCADO_VERSION with the current version of Avocado,
then the drop-in test can use $AVOCADO_VERSION within, and so on.

For the script above:

#!/bin/sh
echo "Avocado Version $AVOCADO_VERSION"
echo "Avocado Test basedir $AVOCADO_TEST_BASEDIR"
echo "Avocado Test datadir $AVOCADO_TEST_DATADIR"
echo "Avocado Test workdir $AVOCADO_TEST_WORKDIR"
echo "Avocado Test srcdir $AVOCADO_TEST_SRCDIR"
echo "Avocado Test logdir $AVOCADO_TEST_LOGDIR"
echo "Avocado Test logfile $AVOCADO_TEST_LOGFILE"
echo "Avocado Test outputdir $AVOCADO_TEST_OUTPUTDIR"
echo "Avocado Test sysinfodir $AVOCADO_TEST_SYSINFODIR"

The expected output is:

...
21:12:30 process L0123 INFO | Running '/home/rmoura/test_avocado_variables.sh'
21:12:30 process L0173 DEBUG| [stdout] Avocado Version 0.8.0
21:12:30 process L0173 DEBUG| [stdout] Avocado Test basedir /home/rmoura/Work/avocado.git/avocado
21:12:30 process L0173 DEBUG| [stdout] Avocado Test datadir /home/rmoura/Work/avocado.git/avocado/test_avocado_variables.sh.data
21:12:30 process L0173 DEBUG| [stdout] Avocado Test workdir /var/tmp/avocado/test_avocado_variables.sh
21:12:30 process L0173 DEBUG| [stdout] Avocado Test srcdir /var/tmp/avocado/test_avocado_variables.sh/src
21:12:30 process L0173 DEBUG| [stdout] Avocado Test logdir /home/rmoura/avocado/logs/run-2014-08-04-21.12.30/home.rmoura.test_avocado_variables.sh.1
21:12:30 process L0173 DEBUG| [stdout] Avocado Test logfile /home/rmoura/avocado/logs/run-2014-08-04-21.12.30/home.rmoura.test_avocado_variables.sh.1/debug.log
21:12:30 process L0173 DEBUG| [stdout] Avocado Test outputdir /home/rmoura/avocado/logs/run-2014-08-04-21.12.30/home.rmoura.test_avocado_variables.sh.1/data
21:12:30 process L0173 DEBUG| [stdout] Avocado Test sysinfodir /home/rmoura/avocado/logs/run-2014-08-04-21.12.30/home.rmoura.test_avocado_variables.sh.1/sysinfo
...

Signed-off-by: Ruda Moura