summaryrefslogtreecommitdiff
path: root/yarns
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-11-06 14:03:01 +0000
committerLars Wirzenius <liw@liw.fi>2015-11-06 14:13:30 +0000
commitaec4f11d5c14e207adf71438d66912b64b57754a (patch)
tree21c18bed871a2750b6fa5ca31f282923d6f93974 /yarns
parentb73dd28dd4a7ab0b850350bf60144089a147eb11 (diff)
downloadvmdebootstrap-aec4f11d5c14e207adf71438d66912b64b57754a.tar.gz
Implement the first fast option checking test
Diffstat (limited to 'yarns')
-rw-r--r--yarns/200-fast-tests.yarn17
-rw-r--r--yarns/900-implements.yarn29
2 files changed, 37 insertions, 9 deletions
diff --git a/yarns/200-fast-tests.yarn b/yarns/200-fast-tests.yarn
index 6e30fa2..1b0ef97 100644
--- a/yarns/200-fast-tests.yarn
+++ b/yarns/200-fast-tests.yarn
@@ -1,8 +1,13 @@
# Fast option check tests
-* A scenario, or set of scenarios, that verify that certain
- combinations of vmdebootstrap options work or fail as expected, but
- without actually building images. The goal is to test command line
- handling quickly. For example, options that conflict should cause
- error messages.
- * FIXME: Check with Neil for suggestions for options.
+This chapter contains fast scenarios that test vmdebootstrap option
+handling. These scenarios do not actually build images, they only
+verify that vmdebootstrap parses the command line correctly.
+
+ SCENARIO --squash and --image used together
+ ASSUMING fast tests are requested
+ WHEN user attempts to run vmdebootstrap
+ ... --squash=FOO --image=BAR --dry-run
+ THEN vmdebootstrap exited with a non-zero exit code
+ AND vmdebootstrap wrote an error message matching --squash
+ AND vmdebootstrap wrote an error message matching --image
diff --git a/yarns/900-implements.yarn b/yarns/900-implements.yarn
index e9e4ec7..72c8f2c 100644
--- a/yarns/900-implements.yarn
+++ b/yarns/900-implements.yarn
@@ -18,11 +18,11 @@ If `TESTS` is not set, everything gets run.
Scenarios can use the ASSUMING statements defined here to let the user
to allow them to run or not to run.
- IMPLEMENTS ASSUMING build tests are requested
- test_requested build
+ IMPLEMENTS ASSUMING (fast|build) tests are requested
+ test_requested "$MATCH_1"
-## Building an image
+## Building an image, or attempting to
To keep individual steps shorter, we provide some steps to set common
parts, such as the name of the image being built.
@@ -40,6 +40,29 @@ but it's actually restricted to vmdebootstrap in the source tree.
--size "$IMAGE_SIZE" \
$MATCH_1
+Attempt to run vmdebootstrap, but allow it it to fail. Capture exit
+code and stderr.
+
+ IMPLEMENTS WHEN user attempts to run vmdebootstrap (.*)
+ if PYTHONPATH="$SRCDIR" "$SRCDIR/bin/vmdebootstrap" \
+ $MATCH_1 2> vmdebootstrap.stderr
+ then
+ echo 0 > vmdebootstrap.exit
+ else
+ echo $? > vmdebootstrap.exit
+ fi
+
+Check for whether the attempted vmdebootstrap run had the desired exit
+code.
+
+ IMPLEMENTS THEN vmdebootstrap exited with a non-zero exit code
+ grep -vFx 0 vmdebootstrap.exit
+
+Check the stderr of the attempted vmdebootstrap run.
+
+ IMPLEMENTS THEN vmdebootstrap wrote an error message matching (.+)
+ grep -P -e "$MATCH_1" vmdebootstrap.stderr
+
## Static tests on disk images