Reduce bloat in test runners
This commit is contained in:
parent
a04dbc90ab
commit
4ca4a06896
2 changed files with 33 additions and 56 deletions
|
@ -1,36 +1,24 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
##
|
|
||||||
# functions
|
|
||||||
run_test()
|
|
||||||
{
|
|
||||||
testfile="${1}"
|
|
||||||
logfile="${2}"
|
|
||||||
ruby -Ilib \
|
|
||||||
"${testfile}" \
|
|
||||||
--no-use-color \
|
|
||||||
> "${logfile}" 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# main
|
# main
|
||||||
if [ "$(id -u)" = "0" ]; then
|
if [ "$(id -u)" != "0" ]; then
|
||||||
|
echo "This script must be run by root"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
bundle exec rake clean clobber compile
|
bundle exec rake clean clobber compile
|
||||||
rm -rf tmp/
|
rm -rf tmp/
|
||||||
for file in test/superuser/*_test.rb; do
|
for test in test/superuser/*_test.rb; do
|
||||||
logfile=".runner.log_$(basename ${file})"
|
log=".$(basename "${test}")_log.txt"
|
||||||
if run_test "${file}" "${logfile}"; then
|
if ruby -Ilib "${test}" --no-use-color > "${log}" 2>&1; then
|
||||||
echo -n .
|
printf "."
|
||||||
rm "${logfile}"
|
rm "${log}"
|
||||||
else
|
else
|
||||||
cat "${logfile}"
|
cat "${log}"
|
||||||
rm "${logfile}"
|
rm "${log}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo
|
echo
|
||||||
else
|
|
||||||
echo "This script must be run by root"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
|
@ -1,35 +1,24 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
##
|
|
||||||
# functions
|
|
||||||
run_test()
|
|
||||||
{
|
|
||||||
testfile="${1}"
|
|
||||||
logfile="${2}"
|
|
||||||
ruby -Ilib \
|
|
||||||
"${testfile}" \
|
|
||||||
--no-use-color \
|
|
||||||
> "${logfile}" 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# main
|
# main
|
||||||
if [ "$(id -u)" != "0" ]; then
|
if [ "$(id -u)" = "0" ]; then
|
||||||
|
echo "This script can't be run by root"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
bundle exec rake clean clobber compile
|
bundle exec rake clean clobber compile
|
||||||
for file in test/unprivileged/*_test.rb; do
|
rm -rf tmp/
|
||||||
logfile=".runner.log_$(basename ${file})"
|
for test in test/unprivileged/*_test.rb; do
|
||||||
if run_test "${file}" "${logfile}"; then
|
log=".$(basename "${test}")_log.txt"
|
||||||
echo -n .
|
if ruby -Ilib "${test}" --no-use-color > "${log}" 2>&1; then
|
||||||
rm "${logfile}"
|
printf "."
|
||||||
|
rm "${log}"
|
||||||
else
|
else
|
||||||
cat "${logfile}"
|
cat "${log}"
|
||||||
rm "${logfile}"
|
rm "${log}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo
|
echo
|
||||||
else
|
|
||||||
echo "This script must be run by a user other than root"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
Loading…
Reference in a new issue