wscript (764B)
1 #! /usr/bin/env python 2 # encoding: utf-8 3 # Thomas Nagy, 2012 (ita) 4 5 VERSION='0.0.1' 6 APPNAME='preproc_test' 7 top = '.' 8 out = 'build' 9 10 from waflib import Utils 11 from waflib.Logs import pprint 12 13 def configure(conf): 14 pass 15 16 def build(bld): 17 18 bld.failure = 0 19 def disp(color, result): 20 pprint(color, result) 21 if color == 'RED': 22 bld.failure=1 23 def stop_status(bld): 24 if bld.failure: 25 bld.fatal('One or several test failed, check the outputs above') 26 bld.add_post_fun(stop_status) 27 28 def test_shell(inp, expected): 29 ret = Utils.shell_escape(inp) 30 if ret == expected: 31 color = "GREEN" 32 else: 33 color = "RED" 34 disp(color, "%r -> %r\t\texpected: %r" % (inp, ret, expected)) 35 36 test_shell("ls -l", "ls -l") 37 test_shell(['ls', '-l', 'a space'], "ls -l 'a space'") 38 39