Properly detect/set test variables from scripts.