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
|
||||
set -e
|
||||
|
||||
##
|
||||
# functions
|
||||
run_test()
|
||||
{
|
||||
testfile="${1}"
|
||||
logfile="${2}"
|
||||
ruby -Ilib \
|
||||
"${testfile}" \
|
||||
--no-use-color \
|
||||
> "${logfile}" 2>&1
|
||||
}
|
||||
|
||||
##
|
||||
# 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
|
||||
rm -rf tmp/
|
||||
for file in test/superuser/*_test.rb; do
|
||||
logfile=".runner.log_$(basename ${file})"
|
||||
if run_test "${file}" "${logfile}"; then
|
||||
echo -n .
|
||||
rm "${logfile}"
|
||||
for test in test/superuser/*_test.rb; do
|
||||
log=".$(basename "${test}")_log.txt"
|
||||
if ruby -Ilib "${test}" --no-use-color > "${log}" 2>&1; then
|
||||
printf "."
|
||||
rm "${log}"
|
||||
else
|
||||
cat "${logfile}"
|
||||
rm "${logfile}"
|
||||
cat "${log}"
|
||||
rm "${log}"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
echo
|
||||
else
|
||||
echo "This script must be run by root"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -1,35 +1,24 @@
|
|||
#!/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
|
||||
if [ "$(id -u)" = "0" ]; then
|
||||
echo "This script can't be run by root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
bundle exec rake clean clobber compile
|
||||
for file in test/unprivileged/*_test.rb; do
|
||||
logfile=".runner.log_$(basename ${file})"
|
||||
if run_test "${file}" "${logfile}"; then
|
||||
echo -n .
|
||||
rm "${logfile}"
|
||||
rm -rf tmp/
|
||||
for test in test/unprivileged/*_test.rb; do
|
||||
log=".$(basename "${test}")_log.txt"
|
||||
if ruby -Ilib "${test}" --no-use-color > "${log}" 2>&1; then
|
||||
printf "."
|
||||
rm "${log}"
|
||||
else
|
||||
cat "${logfile}"
|
||||
rm "${logfile}"
|
||||
cat "${log}"
|
||||
rm "${log}"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
echo
|
||||
else
|
||||
echo "This script must be run by a user other than root"
|
||||
exit 1
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue