From 8a633b2fb93453ac495c2aeec63fb7f91452b063 Mon Sep 17 00:00:00 2001 From: Pagin Matteo Date: Wed, 21 Sep 2022 14:55:21 +0200 Subject: [PATCH] Fix most CLI test cases Copy ns-3 folder in the example subdir DO not copy cmake-cache, as it is directory-dependant --- tests/conftest.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 5f24693..69eb1e8 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -32,7 +32,9 @@ def ns_3(tmpdir): def ns_3_compiled(tmpdir): # Copy the test ns-3 installation in the temporary directory ns_3_tempdir = str(tmpdir.join('ns-3-compiled')) - shutil.copytree(ns_3_test_compiled, ns_3_tempdir, symlinks=True) + shutil.copytree(ns_3_test_compiled, ns_3_tempdir, symlinks=True, + # Do not copy cmake's cache, as it is directory-dependant + ignore=shutil.ignore_patterns("cmake-cache")) build_program = get_build_program(ns_3_tempdir) @@ -155,9 +157,13 @@ def get_and_compile_ns_3(): if not os.path.exists(ns_3_test_compiled_debug): shutil.copytree(ns_3_test, ns_3_test_compiled_debug, symlinks=True) + # Copy folder to run examples + if not os.path.exists(ns_3_examples): + shutil.copytree(ns_3_test, ns_3_examples, symlinks=True) + build_program = get_build_program(ns_3_test_compiled) - if subprocess.call(['python3', build_program, 'configure', '--disable-gtk', + if subprocess.call(['python', build_program, 'configure', '--disable-gtk', '--build-profile=optimized', '--out=build/optimized'], cwd=ns_3_test_compiled, @@ -173,7 +179,7 @@ def get_and_compile_ns_3(): build_program = get_build_program(ns_3_test_compiled_debug) - if subprocess.call(['python3', build_program, 'configure', '--disable-gtk', + if subprocess.call(['python', build_program, 'configure', '--disable-gtk', '--build-profile=debug', '--out=build'], cwd=ns_3_test_compiled_debug, @@ -189,12 +195,13 @@ def get_and_compile_ns_3(): build_program = get_build_program(ns_3_examples) - if subprocess.call(['python3', build_program, 'configure', '--disable-gtk', + if subprocess.call(['python', build_program, 'configure', '--disable-gtk', '--build-profile=optimized', '--out=build/optimized'], cwd=ns_3_examples, stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT) != 0: + raise Exception("Examples configuration failed.") if subprocess.call(['python', build_program, 'build'],