Fix tests under FreeBSD.

check-debug, check-path, and check-system-flags used the following pattern which fails under FreeBSD's /bin/sh

VAR_NAME=value run_test --args

When this is run VAR_NAME is not exported to run_test so I changed this pattern to:

export VAR_NAME
run_test --args

Also added unset in a few cases where it would/could make a difference.

Merge request reports