Compare commits

...

5 Commits

Author SHA1 Message Date
Thomas Levine
a4d09016ab blarg 2016-02-26 18:27:40 +00:00
Thomas Levine
499b6ee131 update history 2016-02-26 18:20:39 +00:00
Thomas Levine
fb2a8e72e6 implement run on a single file 2016-02-26 18:19:26 +00:00
Thomas Levine
e7d5a35409 Automatic commit with j 2016-02-26 18:16:24 +00:00
Thomas Levine
5aba84246f test single file 2016-02-26 17:54:53 +00:00
12 changed files with 40 additions and 37 deletions

15
HISTORY
View File

@ -4,9 +4,11 @@ HISTORY
Version 0.0.7
---------------------
### Molly-guard
The Molly-guard is now more accepting. For example, you no longer need to
pass -f in this case: https://github.com/creationix/nvm/issues/357
### Skipping tests
Previously, tests were run if they were executable and were otherwise marked
as skipped. Now, an executable script can indicate that it is skipped by
exiting with code 3. For example, if a test requires some dependancy, it
@ -24,6 +26,19 @@ would the appropriate status code if these tests were Nagios plugins, as the
concept of skipping a test is similar to the Nagios concept of unknown service
status (https://nagios-plugins.org/doc/guidelines.html#AEN78).
### Run on a file
It is now possible to run urchin on a single file.
This occurred to me when I wanted to run
urchin test/fast/Unit\ tests/nvm_ls_current
on the nvm tests. I wound up running this instead.
urchin test/fast/Unit\ tests/ | grep nvm_ls_current
The Molly guard is assessed, and the corresponding setup, setup_dir,
teardown, and teardown_dir files are run in the appropriate order.
Version 0.0.6
---------------------

16
TODO
View File

@ -123,22 +123,6 @@ cleanly create and teardown temporary files.
On the other hand, this could just be sourced explicitly in the test file,
without the special setup and teardown feature.
Run on a file
----------------
Presently you can run urchin only on a directory.
It would be neat if you could run it on a file as well.
This occurred to me when I wanted to run
urchin test/fast/Unit\ tests/nvm_ls_current
on the nvm tests. I wound up running this instead.
urchin test/fast/Unit\ tests/ | grep nvm_ls_current
The Molly guard would be assessed, and the corresponding setup, setup_dir,
teardown, and teardown_dir files would be run in the appropriate order.
Running automated tasks
-------------------------
Urchin might be appropriate for if you have lots of tasks that you want to run

0
tests/Single file/.test Executable file
View File

View File

@ -0,0 +1 @@
echo setup

View File

@ -0,0 +1 @@
echo setup_dir

View File

@ -0,0 +1 @@
echo teardown

View File

@ -0,0 +1 @@
echo teardown_dir

View File

@ -0,0 +1,2 @@
echo thetest
exit 1

View File

@ -0,0 +1,3 @@
#!/bin/sh
../../urchin .test
# This will exit 0 if it worked.

View File

@ -0,0 +1,2 @@
#!/bin/sh
! ../../urchin not-a-file

View File

@ -0,0 +1,4 @@
tmp=$(mktemp)
echo "Using temp file $tmp"
../../urchin .wrappers > $tmp
diff $tmp .wrapper-expectation

31
urchin
View File

@ -16,13 +16,6 @@ unset CDPATH
# Urchin version number
VERSION=0.0.6
fullpath() {
(
cd -- "$1"
pwd
)
}
indent() {
level="$1"
if test "$level" -gt 0; then
@ -298,21 +291,17 @@ do
shift
done
# Verify argument for main stuff
if [ "$#" != '1' ] || [ ! -d "$1" ]
then
[ -n "$1" ] && [ ! -d "$1" ] && echo "Not a directory: '$1'" >&2
echo "$USAGE" >&2
exit 11
fi
# Constants
logfile=$(fullpath "$1")/.urchin.log
stdout_file=$(fullpath "$1")/.urchin_stdout
# Run or present the Molly guard.
if fullpath "$1" | grep -Fi 'test' > /dev/null || $force
then
thetest=$(readlink -f "$1")
if echo "$thetest" | grep -Fi 'test' > /dev/null || $force; then
if test -d "$1"; then
d="$thetest"
else
d=$(echo "$thetest" | sed 's/\/[^\/]\{1,\}$//')
cd "$d"
fi
logfile="$d/.urchin.log"
stdout_file="$d/.urchin_stdout"
urchin_go "$1" "$shell_for_sh_tests"
else
urchin_molly_guard