-# Cleanup rpath in executables and shared libraries
-#find "$WORKSPACE/$PREFIX/bin" -type f -perm -0500 -exec chrpath --delete {} \;
-find "$WORKSPACE/$PREFIX/lib" -name "*.so" -exec chrpath --delete {} \;
+ # Run tests, don't fail now, we want to run the archiving steps
+ $MAKE --keep-going check || exit_status=1
+
+ # Only run regtest for 0.9 and up
+ if vergte "$PACKAGE_VERSION" "0.9"; then
+ $MAKE --keep-going regtest || exit_status=1
+ fi
+
+ # Copy tap logs for the jenkins tap parser before cleaning the build dir
+ rsync -a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*' tests/ "$WORKSPACE/tap"
+
+ # Copy the test suites top-level log which includes all tests failures
+ rsync -a --include 'test-suite.log' --include '*/' --exclude='*' tests/ "$WORKSPACE/log"
+
+ # The test suite prior to 0.11 did not produce TAP logs
+ if verlt "$PACKAGE_VERSION" "0.11"; then
+ mkdir -p "$WORKSPACE/tap/no-log"
+ echo "1..1" > "$WORKSPACE/tap/no-log/tests.log"
+ echo "ok 1 - Test suite doesn't support logging" >> "$WORKSPACE/tap/no-log/tests.log"
+ fi
+fi
+
+# Clean the build directory
+if [ "$USERSPACE_RCU_MAKE_CLEAN" = "yes" ]; then
+ print_header "Clean"
+ $MAKE clean
+fi