scripts/build_and_test_all.sh: Fix minor bugs

* scripts/build_and_test_all.sh: Fix segfault on exit in trap
handler. Don't try to test examples when cross compiling.