run-tests.sh: Ensure that environment variables are set when sourcing tests

I ran into an issue where I had something like:

    some_file="$testdir/filename"

in my test script.  This was being evaluated at test discovery time so the
filename was not what I was expecting.  This commit fixes this issue by
exporting those constant test variables before doing test discovery.

This restores the behaviour from before 4843875.