Compare commits
30 Commits
v0.1.0-rc3
...
try-time
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fae4c7025e | ||
|
|
539027db59 | ||
|
|
5e2ecab592 | ||
|
|
efe3af6f87 | ||
|
|
f244c22055 | ||
|
|
2cdd3ec049 | ||
|
|
6744b2cb4a | ||
|
|
6e32dab0b7 | ||
|
|
bb3876f334 | ||
|
|
0dc6e01fbc | ||
|
|
ca71678522 | ||
|
|
9b4f14c937 | ||
|
|
27592e58ac | ||
|
|
42c09b775b | ||
|
|
2923d3a8b0 | ||
|
|
12f458a933 | ||
|
|
6c217acae8 | ||
|
|
6a7e58c944 | ||
|
|
32ac65cf3e | ||
|
|
d1c8f78585 | ||
|
|
132e1695db | ||
|
|
d67185ce25 | ||
|
|
16988c48a9 | ||
|
|
ddb74d43d8 | ||
|
|
04c4f54789 | ||
|
|
552d7d0dbc | ||
|
|
00c99773d0 | ||
|
|
7899657971 | ||
|
|
2ee965d2ae | ||
|
|
fdb0b1b3ea |
8
HISTORY
8
HISTORY
@@ -5,6 +5,14 @@ Version 0.1.0
|
||||
---------------------
|
||||
This release includes breaking changes.
|
||||
|
||||
### Cross-OS testing
|
||||
I have started testing Urchin across multiple operating systems.
|
||||
This gives access to more shells, as some shels are easier to install on
|
||||
certain operating systems.
|
||||
|
||||
With this cross-OS test suite, I have extended support to more shells.
|
||||
A later version of Urchin could include a remote testing feature.
|
||||
|
||||
### Test root directory
|
||||
We introduce a concept of the root directory of a test suite.
|
||||
Such a concept is important in case you want to run subsets of your
|
||||
|
||||
8
Makefile
Normal file
8
Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
.PHONY: test install
|
||||
|
||||
test:
|
||||
./urchin tests
|
||||
./urchin -s sh -v ./cross-os-tests
|
||||
|
||||
install:
|
||||
cp ./urchin /usr/bin
|
||||
51
TODO
51
TODO
@@ -63,3 +63,54 @@ bash
|
||||
Alternatives
|
||||
--------------
|
||||
JSON.sh test suite
|
||||
|
||||
Running in multiple environments
|
||||
-----------------------------------
|
||||
Setup for other environments includes the following.
|
||||
|
||||
* Installing packages
|
||||
* `touch .zshrc`
|
||||
* Copy urchin and tests
|
||||
|
||||
Bugs
|
||||
-------
|
||||
|
||||
Both md5sum and md5 should be supported.
|
||||
|
||||
Trouble logging in to hpux, irix, miros, netbsd, tru64, qnx, ....
|
||||
|
||||
$ rsync -e 'ssh -p 785' urchin tlevine@hpux.polarhome.com:.blah
|
||||
HP-UX hpux.polarhome.com B.11.11 U 9000/785 (ta)
|
||||
Welcome to HPUX/PA... member of polarhome.com realm
|
||||
|
||||
bash: rsync: command not found
|
||||
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
|
||||
rsync error: remote command not found (code 127) at io.c(226)
|
||||
[sender=3.1.1]
|
||||
|
||||
|
||||
OpenIndiana grep does not support -q
|
||||
|
||||
I get `/urchin: syntax error at line 84: \`}' unexpected` on
|
||||
unixware and solaris.
|
||||
|
||||
mktemp
|
||||
|
||||
> tlevine@hpux.polarhome.com -p 785
|
||||
F sh (8 seconds)
|
||||
|
|
||||
| HP-UX hpux.polarhome.com B.11.11 U 9000/785 (ta)
|
||||
| Welcome to HPUX/PA... member of polarhome.com realm
|
||||
|
|
||||
|
|
||||
| HP-UX hpux.polarhome.com B.11.11 U 9000/785 (ta)
|
||||
| Welcome to HPUX/PA... member of polarhome.com realm
|
||||
|
|
||||
| mktemp: option requires an argument -- d
|
||||
| ./urchin[96]: /tmp/tlevinea21441/log: Cannot create the specified file.
|
||||
|
||||
date
|
||||
|
||||
tlevine@hpux64$ ./urchin tests/ -n -vv
|
||||
date: bad format character - s
|
||||
|
||||
|
||||
13
cross-os-tests/.run
Executable file
13
cross-os-tests/.run
Executable file
@@ -0,0 +1,13 @@
|
||||
params="$(basename "${0}")"
|
||||
|
||||
hostname="$(echo "${params}" | cut -d\ -f1)"
|
||||
if echo "${params}" | grep -q \ ; then
|
||||
flags="$(echo "${params}" | cut -d\ -f2-)"
|
||||
fi
|
||||
|
||||
urchin_dir=.urchin-cross-shell-test
|
||||
|
||||
rsync --archive -e "ssh ${flags}" $RSYNC_FLAGS \
|
||||
../urchin ../tests "${hostname}":"${urchin_dir}"
|
||||
ssh "${hostname}" ${flags} \
|
||||
"cd ${urchin_dir} && ./urchin --run-in-series tests"
|
||||
2
cross-os-tests/tlevine@centos.polarhome.com -p 925
Executable file
2
cross-os-tests/tlevine@centos.polarhome.com -p 925
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
||||
3
cross-os-tests/tlevine@dada.pink
Executable file
3
cross-os-tests/tlevine@dada.pink
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
# apt-get install bash dash ksh posh pdksh mksh yash zsh
|
||||
. ./.run
|
||||
2
cross-os-tests/tlevine@debian-ppc.polarhome.com -p 625
Executable file
2
cross-os-tests/tlevine@debian-ppc.polarhome.com -p 625
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
||||
2
cross-os-tests/tlevine@debian.polarhome.com -p 755
Executable file
2
cross-os-tests/tlevine@debian.polarhome.com -p 755
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
||||
2
cross-os-tests/tlevine@dragonfly.polarhome.com -p 915
Executable file
2
cross-os-tests/tlevine@dragonfly.polarhome.com -p 915
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
||||
2
cross-os-tests/tlevine@freebsd.polarhome.com -p 715
Executable file
2
cross-os-tests/tlevine@freebsd.polarhome.com -p 715
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
||||
2
cross-os-tests/tlevine@hpux-ia64.polarhome.com -p 965
Executable file
2
cross-os-tests/tlevine@hpux-ia64.polarhome.com -p 965
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
||||
3
cross-os-tests/tlevine@hpux.polarhome.com -p 785
Executable file
3
cross-os-tests/tlevine@hpux.polarhome.com -p 785
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
RSYNC_FLAGS='--rsync-path=/usr/local/bin/rsync'
|
||||
. ./.run
|
||||
2
cross-os-tests/tlevine@irix.polarhome.com -p 825
Executable file
2
cross-os-tests/tlevine@irix.polarhome.com -p 825
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
||||
3
cross-os-tests/tlevine@miros.polarhome.com -p 935
Executable file
3
cross-os-tests/tlevine@miros.polarhome.com -p 935
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
# SSH public key needs to be in ~/.etc/ssh/authorized_keys
|
||||
. ./.run
|
||||
2
cross-os-tests/tlevine@netbsd.polarhome.com -p 745
Executable file
2
cross-os-tests/tlevine@netbsd.polarhome.com -p 745
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
||||
2
cross-os-tests/tlevine@openbsd.polarhome.com -p 735
Executable file
2
cross-os-tests/tlevine@openbsd.polarhome.com -p 735
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
||||
2
cross-os-tests/tlevine@openindiana.polarhome.com -p 845
Executable file
2
cross-os-tests/tlevine@openindiana.polarhome.com -p 845
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
||||
2
cross-os-tests/tlevine@pidora.polarhome.com -p 615
Executable file
2
cross-os-tests/tlevine@pidora.polarhome.com -p 615
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
||||
2
cross-os-tests/tlevine@qnx.polarhome.com -p 815
Executable file
2
cross-os-tests/tlevine@qnx.polarhome.com -p 815
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
||||
2
cross-os-tests/tlevine@raspbian.polarhome.com -p 975
Executable file
2
cross-os-tests/tlevine@raspbian.polarhome.com -p 975
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
||||
2
cross-os-tests/tlevine@redhat.polarhome.com -p 795
Executable file
2
cross-os-tests/tlevine@redhat.polarhome.com -p 795
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
||||
2
cross-os-tests/tlevine@scosysv.polarhome.com -p 895
Executable file
2
cross-os-tests/tlevine@scosysv.polarhome.com -p 895
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
||||
2
cross-os-tests/tlevine@solaris-x86.polarhome.com -p 865
Executable file
2
cross-os-tests/tlevine@solaris-x86.polarhome.com -p 865
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
||||
2
cross-os-tests/tlevine@solaris.polarhome.com -p 725
Executable file
2
cross-os-tests/tlevine@solaris.polarhome.com -p 725
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
||||
2
cross-os-tests/tlevine@tru64.polarhome.com -p 835
Executable file
2
cross-os-tests/tlevine@tru64.polarhome.com -p 835
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
||||
2
cross-os-tests/tlevine@ubuntu.polarhome.com -p 885
Executable file
2
cross-os-tests/tlevine@ubuntu.polarhome.com -p 885
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
||||
2
cross-os-tests/tlevine@unixware.polarhome.com -p 905
Executable file
2
cross-os-tests/tlevine@unixware.polarhome.com -p 905
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
||||
83
urchin
83
urchin
@@ -51,7 +51,17 @@ set -e
|
||||
# Kill subprocesses on interrupt.
|
||||
trap "kill -$$; exit" HUP INT TERM
|
||||
|
||||
DEFAULT_SHELLS='sh bash dash mksh zsh'
|
||||
DEFAULT_SHELLS='
|
||||
sh
|
||||
bash
|
||||
dash
|
||||
ksh
|
||||
posh
|
||||
pdksh
|
||||
mksh
|
||||
yash
|
||||
zsh
|
||||
'
|
||||
if [ -n "${ZSH_VERSION}" ]; then
|
||||
# avoid "no matches found: *" error when directories are empty
|
||||
setopt NULL_GLOB
|
||||
@@ -81,20 +91,44 @@ validate_test_arg() {
|
||||
}
|
||||
|
||||
# All temporary files go here
|
||||
urchin_tmp=$(mktemp -d)
|
||||
urchin_tmp=$(mktemp)
|
||||
|
||||
# Support HP-UX mktemp that has wrong exit codes and
|
||||
# can't make directories.
|
||||
if test -f "${urchin_tmp}"; then
|
||||
rm "${urchin_tmp}"
|
||||
fi
|
||||
mkdir "${urchin_tmp}"
|
||||
|
||||
> "${urchin_tmp}/log"
|
||||
|
||||
urchin_exit() {
|
||||
rm -Rf "${urchin_tmp}"
|
||||
exit "$@"
|
||||
}
|
||||
|
||||
if which md5 1> /dev/null 2> /dev/null; then
|
||||
urchin_md5=md5
|
||||
elif which md5sum 1> /dev/null 2> /dev/null; then
|
||||
urchin_md5=md5sum
|
||||
else
|
||||
echo Could not find MD5 hash command >&2
|
||||
urchin_exit 1
|
||||
fi
|
||||
|
||||
|
||||
stdout_file() {
|
||||
the_test="${1}"
|
||||
the_shell="${2}"
|
||||
|
||||
x="${urchin_tmp}/stdout$(fullpath "$the_test")"
|
||||
mkdir -p "${x}"
|
||||
echo "${x}/$(echo "${the_shell}" | md5sum | cut -d\ -f1)"
|
||||
case "${urchin_md5}" in
|
||||
md5sum) y=$(echo "${the_shell}" | md5sum | cut -d\ -f1) ;;
|
||||
md5) y=$(echo "${the_shell}" | md5 -q) ;;
|
||||
*) echo md5 command is not configured >&2; urchin_exit 1;;
|
||||
esac
|
||||
echo "${x}/${y}"
|
||||
}
|
||||
|
||||
# Expand relative paths
|
||||
@@ -137,7 +171,7 @@ urchin_root() {
|
||||
}
|
||||
|
||||
# Urchin version number
|
||||
VERSION=0.1.0-rc2
|
||||
VERSION=0.1.1-unstable
|
||||
|
||||
indent() {
|
||||
level="${1}"
|
||||
@@ -301,7 +335,7 @@ recurse() {
|
||||
done < "${shell_list}"
|
||||
wait
|
||||
else
|
||||
echo "${potential_test}: Neither file nor directory!?" > /dev/stderr
|
||||
echo "${potential_test}: Neither file nor directory!?" >&2
|
||||
fi
|
||||
else
|
||||
# Shell is ''
|
||||
@@ -313,11 +347,9 @@ report_outcome() {
|
||||
root="${1}"
|
||||
tap_format="${2}"
|
||||
log_file="${3}"
|
||||
start="${4}"
|
||||
finish="${5}"
|
||||
elapsed="${4}"
|
||||
|
||||
escaped_root="$(fullpath "${root}" | sed 's/\//\\\//g')"
|
||||
elapsed=$(($finish - $start))
|
||||
|
||||
if "${tap_format}"; then
|
||||
printf \#\
|
||||
@@ -333,7 +365,7 @@ report_outcome() {
|
||||
# Use a temporary file rather than a pipe because a pipe starts a sub-shell
|
||||
# and thus makes the above variables local.
|
||||
sorted_log_file=$(mktemp)
|
||||
cat "${log_file}" | LC_ALL=POSIX sort > "${sorted_log_file}"
|
||||
cat "${log_file}" | LC_COLLATE=C sort > "${sorted_log_file}"
|
||||
|
||||
while read line; do
|
||||
abspath=$(echo "${line}" | cut -f1)
|
||||
@@ -578,7 +610,7 @@ main() {
|
||||
validate_strings "${shell_for_sh_tests}" 'Shell paths'
|
||||
if echo "${shell_for_sh_tests}" | grep -q \ ; then
|
||||
echo "Warning: It is best if shell paths contain no spaces so that
|
||||
you don't need to quote the TEST_SHELL variable." > /dev/stderr
|
||||
you don't need to quote the TEST_SHELL variable." >&2
|
||||
fi
|
||||
|
||||
echo "${shell_for_sh_tests}" >> "${shell_list}"
|
||||
@@ -641,7 +673,7 @@ main() {
|
||||
if ! test -f "${shell_list}"; then
|
||||
if $cycle_shell; then
|
||||
for shell in $DEFAULT_SHELLS; do
|
||||
if which $shell > /dev/null; then
|
||||
if which $shell 1> /dev/null 2> /dev/null; then
|
||||
echo $shell >> "$shell_list"
|
||||
fi
|
||||
done
|
||||
@@ -673,22 +705,23 @@ main() {
|
||||
fi
|
||||
|
||||
# -------------------- REALLY RUN -------------------- #
|
||||
start=$(date +%s)
|
||||
elapsed=$({
|
||||
time {
|
||||
# 1 test file or folder to run
|
||||
# 2 urchin root
|
||||
# 3 Should we cycle shells?
|
||||
# 4 TEST_SHELL
|
||||
while read seed; do
|
||||
recurse "$(fullpath "${seed}")" "${root}" "${cycle_shell}" \
|
||||
"${TEST_SHELL}" || break
|
||||
done < "${test_arg_list}"
|
||||
}
|
||||
} 3>&1 1>&2 2>&3 3>& | grep ^real | cut -f 2)
|
||||
|
||||
# 1 test file or folder to run
|
||||
# 2 urchin root
|
||||
# 3 Should we cycle shells?
|
||||
# 4 TEST_SHELL
|
||||
while read seed; do
|
||||
recurse "$(fullpath "${seed}")" "${root}" "${cycle_shell}" \
|
||||
"${TEST_SHELL}" || break
|
||||
done < "${test_arg_list}"
|
||||
finish=$(date +%s)
|
||||
|
||||
test $(cat "${urchin_tmp}"/log | wc -l) -gt 0 || {
|
||||
echo 'No tests found' > /dev/stderr
|
||||
if test $(cat "${urchin_tmp}"/log | wc -l) -eq 0; then
|
||||
echo 'No tests found' >&2
|
||||
urchin_exit 1
|
||||
}
|
||||
fi
|
||||
|
||||
report_outcome "${root}" "${tap_format}" "${urchin_tmp}"/log "${start}" \
|
||||
"${finish}"
|
||||
|
||||
Reference in New Issue
Block a user