From 31c24bc7e328fb2e8d75893c675f63e37dc2e6dc Mon Sep 17 00:00:00 2001 From: Russel Winder Date: Sun, 10 Jan 2016 15:55:12 +0000 Subject: Refactor of test, but it still fails due to missing output from SCons. --- test/Clean/mkfifo.py | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/test/Clean/mkfifo.py b/test/Clean/mkfifo.py index 0ef7662..01e4d98 100644 --- a/test/Clean/mkfifo.py +++ b/test/Clean/mkfifo.py @@ -38,35 +38,40 @@ test = TestSCons.TestSCons() if not hasattr(os, 'mkfifo'): test.skip_test('No os.mkfifo() function; skipping test\n') +test_dir_name = 'testdir' +pipe_path = os.path.join(test_dir_name, 'namedpipe') + test.write('SConstruct', """\ -Execute(Mkdir("testdir")) -dir = Dir("testdir") -Clean(dir, 'testdir') -""") +Execute(Mkdir("{0}")) +dir = Dir("{0}") +Clean(dir, '{0}') +""".format(test_dir_name)) + +test.run(arguments='-Q -q', stdout='Mkdir("{0}")\n'.format(test_dir_name)) -test.run(arguments='-Q -q', stdout='Mkdir("testdir")\n') +os.mkfifo(pipe_path) -os.mkfifo('testdir/namedpipe') +test.must_exist(test.workpath(pipe_path)) expect1 = """\ -Mkdir("testdir") -Path '%s' exists but isn't a file or directory. -scons: Could not remove 'testdir': Directory not empty -""" % os.path.join('testdir', 'namedpipe') +Mkdir("{0}") +Path '{1}' exists but isn't a file or directory. +scons: Could not remove '{0}': Directory not empty +""".format(test_dir_name, pipe_path) expect2 = """\ -Mkdir("testdir") -Path '%s' exists but isn't a file or directory. -scons: Could not remove 'testdir': File exists -""" % os.path.join('testdir', 'namedpipe') +Mkdir("{0}") +Path '{1}' exists but isn't a file or directory. +scons: Could not remove '{0}': File exists +""".format(test_dir_name, pipe_path) test.run(arguments='-c -Q -q') +test.must_exist(test.workpath(pipe_path)) + if test.stdout() not in [expect1, expect2]: test.diff(expect1, test.stdout(), 'STDOUT ') test.fail_test() - -test.must_exist(test.workpath('testdir/namedpipe')) test.pass_test() -- cgit v0.12