Browse Source

[1878] added run_lettuce.sh script, and check in terrain

Jelte Jansen 13 years ago
parent
commit
8df566b82d

+ 8 - 12
tests/lettuce/README

@@ -6,7 +6,7 @@ these tests are specific for BIND10, but we are keeping in mind that RFC-related
 tests could be separated, so that we can test other systems as well.
 
 Prerequisites:
-- Installed version of BIND 10 (but see below how to run it from source tree)
+- BIND 10 must be compiled or installed
 - dig
 - lettuce (http://lettuce.it)
 
@@ -26,27 +26,23 @@ Port 47805 is used for cmdctl, and must also be available.
 (note, we will need to extend this to a range, or if possible, we will need to
 do some on-the-fly available port finding)
 
-The bind10 main program, bindctl, and dig must all be in the default search 
-path of your environment, and BIND 10 must not be running if you use the 
-installed version when you run the tests.
+You can run the lettuce tests with the provided run_lettuce.sh script.
 
-If you want to test an installed version of bind 10, just run 'lettuce' in
-this directory.
+By default it will use the build tree, but you can use an installed version
+of bind10 by passing -I as the first argument of run_lettuce.sh
 
-We have provided a script that sets up the shell environment to run the tests
-with the build tree version of bind. If your shell uses export to set
-environment variables, you can source the script setup_intree_bind10.sh, then
-run lettuce.
+The tool 'dig' must be in the default search path of your environment. If
+you specified -I, so must the main bind10 program, as well as bindctl.
 
 Due to the default way lettuce prints its output, it is advisable to run it
 in a terminal that is wide than the default. If you see a lot of lines twice
 in different colors, the terminal is not wide enough.
 
 If you just want to run one specific feature test, use
-lettuce features/<feature file>
+run_lettuce.sh [-I] features/<feature file>
 
 To run a specific scenario from a feature, use
-lettuce features/<feature file> -s <scenario number>
+run_lettuce.sh [-I] features/<feature file> -s <scenario number>
 
 We have set up the tests to assume that lettuce is run from this directory,
 so even if you specify a specific feature file, you should do it from this

+ 11 - 1
tests/lettuce/features/terrain/terrain.py

@@ -28,6 +28,7 @@ import subprocess
 import os.path
 import shutil
 import re
+import sys
 import time
 
 # In order to make sure we start all tests with a 'clean' environment,
@@ -383,4 +384,13 @@ def cleanup(scenario):
         world.processes.keep_files()
     # Stop any running processes we may have had around
     world.processes.stop_all_processes()
-    
+
+# Environment check
+# Checks if LETTUCE_SETUP_COMPLETED is set in the environment
+# If not, abort with an error to use the run-script
+if 'LETTUCE_SETUP_COMPLETED' not in os.environ:
+    print("Environment check failure; LETTUCE_SETUP_COMPLETED not set")
+    print("Please use the run_lettuce.sh script. If you want to test an")
+    print("installed version of bind10 with these tests, use")
+    print("run_lettuce.sh -I [lettuce arguments]")
+    sys.exit(1)

+ 8 - 0
tests/lettuce/run_lettuce.sh

@@ -0,0 +1,8 @@
+if [ "$1" = "-I" ]; then
+    shift
+    echo "$@"
+    LETTUCE_SETUP_COMPLETED=1 lettuce $@
+else
+    source ./setup_intree_bind10.sh
+    exec lettuce $@
+fi

+ 2 - 0
tests/lettuce/setup_intree_bind10.sh.in

@@ -44,3 +44,5 @@ export B10_FROM_BUILD
 
 BIND10_MSGQ_SOCKET_FILE=@abs_top_builddir@/msgq_socket
 export BIND10_MSGQ_SOCKET_FILE
+
+export LETTUCE_SETUP_COMPLETED=1