bsdcontrol.rb/bin/run-unprivileged-tests
2024-05-12 21:28:48 -03:00

35 lines
678 B
Bash
Executable file

#!/bin/sh
set -e
##
# functions
run_test()
{
testfile="${1}"
logfile="${2}"
ruby -Ilib \
"${testfile}" \
--no-use-color \
> "${logfile}" 2>&1
}
##
# main
if [ "$(id -u)" != "0" ]; then
rake clean clobber compile
for file in test/readme_examples_test.rb test/unprivileged/*_test.rb; do
logfile=".runner.log_$(basename ${file})"
if run_test "${file}" "${logfile}"; then
echo -n .
rm "${logfile}"
else
cat "${logfile}"
rm "${logfile}"
exit 1
fi
done
echo
else
echo "This script must be run by a user other than root"
exit 1
fi