Home Recent Changes WikiHelp
Openswan /
WritingUMLTests
Login
Last modified: August 08, 2006, at 10:03 AM

How to write your own tests:

  1. Determine what type of test - KLIPS, pluto, packaging, kernelconfig utils. Under the proper subdirectory of testing/, create a new subdir.
  2. Add your test to testing/TEST-TYPE/TESTLIST
  3. Populate the directory with the test files. The best way to do this is to find an existing test that does something similar to what you are trying, and copy the files in and modify them.

Common files:

#!/bin/sh

# There are two main purposes, regress, or goal.
# goal: something that *must* pass for a release
# regress: a feature we always want to test, in case new code breaks it
TEST_PURPOSE=regress
TEST_PROB_REPORT=0

# There are several 'types' of tests
# umlplutotest - Testing pluto under UML
# klipstest - Test KLIPS
# ctltest - ?
# mkinsttest - Test of 'make install'
# kernel_patch_test - Test patching of a kernel
# module_compile - Test building of the ipsec.o module
# umlXhost - Test involving several UML hosts
TEST_TYPE=umlplutotest

# The name of the test.  Must not be duplicated elsewhere in the testing tree.
TESTNAME=dpd-01

# UML virtual 'hosts' you want to run
EASTHOST=east
WESTHOST=west

# Output files for each hosts's console
REF_EAST_CONSOLE_OUTPUT=east-console.txt
REF_WEST_CONSOLE_OUTPUT=west-console.txt

# Scripts to run against the console.txt files.  These remove specific version #s, or
# other variable strings and swap in CONSTANTS.
REF_CONSOLE_FIXUPS="kern-list-fixups.sed nocr.sed"
REF_CONSOLE_FIXUPS="$REF_CONSOLE_FIXUPS cutout.sed"
REF_CONSOLE_FIXUPS="$REF_CONSOLE_FIXUPS east-prompt-splitline.pl"
REF_CONSOLE_FIXUPS="$REF_CONSOLE_FIXUPS ipsec-look-esp-sanitize.pl"
REF_CONSOLE_FIXUPS="$REF_CONSOLE_FIXUPS klips-debug-sanitize.sed"
REF_CONSOLE_FIXUPS="$REF_CONSOLE_FIXUPS ipsec-setup-sanitize.sed"
REF_CONSOLE_FIXUPS="$REF_CONSOLE_FIXUPS pluto-whack-sanitize.sed"
REF_CONSOLE_FIXUPS="$REF_CONSOLE_FIXUPS host-ping-sanitize.sed"

# Initialization scripts.  Usually one per host.  Use these to start ipsec, load a conn
EAST_INIT_SCRIPT=eastinit.sh
WEST_INIT_SCRIPT=westinit.sh

# These are the scripts that normally run your test
# Note1: These do NOT run in parallel.  They are run one at a time.  If you want to do play-by-play
# interaction, use EAST_RUN2_SCRIPT=eastrun2.sh, etc...
# Note2: East is run before west
#
EAST_RUN_SCRIPT=eastrun.sh
WEST_RUN_SCRIPT=westrun.sh

# Scripts to run at the end.  Usefull to tail /tmp/pluto.log, or 'ipsec auto --look' to get a final # look at the state of things.
EAST_FINAL_SCRIPT=final.sh
WEST_FINAL_SCRIPT=final.sh

NETJIG_EXTRA=debugpublic.txt

Misc. Notes:

  1. There is a timeout to catch when a process does not return to a prompt for the *init.sh, *run.sh scripts. So don't do things like 'sleep 60' - instead, do 'sleep 10' 6 times.
Powered by PmWiki
view edit upload print history