diff options
author | Lars Wirzenius <liw@liw.fi> | 2015-12-25 13:06:49 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2015-12-26 16:44:58 +0100 |
commit | f097c61b1c1435d4849a33930cb75332dc7158dc (patch) | |
tree | f7632248ce5bb584ac11fe9de64dfba7e67a366f /yarns/900-implements.yarn | |
parent | da859589e5295e5d050abff73773c006cf81ead1 (diff) | |
download | obnam-benchmarks-f097c61b1c1435d4849a33930cb75332dc7158dc.tar.gz |
Rewrite obbench, adding yarns and Debian packaging
Diffstat (limited to 'yarns/900-implements.yarn')
-rw-r--r-- | yarns/900-implements.yarn | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/yarns/900-implements.yarn b/yarns/900-implements.yarn new file mode 100644 index 0000000..a0004cf --- /dev/null +++ b/yarns/900-implements.yarn @@ -0,0 +1,58 @@ +# Scenario step implementations + +This chapter contains implementations of the scenario steps, so that +this manual may be used as an automated test suite for obbench. See +[yarn][] documentation for understanding this. + +We use Python to implement the steps. This requires at least +version 0.19 of yarn. + +## Create benchmark specification file + + IMPLEMENTS GIVEN a benchmark specification file (\S+) containing (.*) + import os + filename = os.environ['MATCH_1'] + config_text = os.environ['MATCH_2'] + with open(filename, 'w') as f: + f.write(config_text) + +## Create a local configuration file + + IMPLEMENTS GIVEN an obbench configuration file (\S+) containing (.*) + import os + filename = os.environ['MATCH_1'] + config_text = os.environ['MATCH_2'] + with open(filename, 'w') as f: + f.write(config_text) + +## Run obbench, with arguments + + IMPLEMENTS WHEN I run obbench (.*) + import os + import cliapp + arg_string = os.environ['MATCH_1'] + args = arg_string.split() + srcdir = os.environ['SRCDIR'] + obbench = os.path.join(srcdir, 'obbench') + cliapp.runcmd([obbench] + args, stdout=None, stderr=None) + +### Check directory existence + + IMPLEMENTS THEN directory (\S+) exists + import os + dirname = os.environ['MATCH_1'] + assert os.path.isdir(dirname), "dir {} doesn't exist".format(dirname) + +### Check file existence + + IMPLEMENTS THEN file (\S+) exists + import os + filename = os.environ['MATCH_1'] + assert os.path.isfile(filename), "file {} doesn't exist".format(filename) + +### Check glob matching + + IMPLEMENTS THEN files matching (\S+) exist + import glob, os + pattern = os.environ['MATCH_1'] + assert glob.glob(pattern) != [], "glob {} doesn't match".format(pattern) |