From 0b2c62bf93ab982a86d74d30656204cd7742d00a Mon Sep 17 00:00:00 2001 From: Gabriel Ferreira Date: Sat, 6 Aug 2022 21:08:23 -0300 Subject: [PATCH] build: fix typos and formatting --- ns3 | 8 ++--- utils/tests/gitlab-ci-alpine.yml | 2 +- utils/tests/gitlab-ci-ubuntu.yml | 2 +- utils/tests/test-ns3.py | 54 ++++++++++++++++++-------------- 4 files changed, 36 insertions(+), 30 deletions(-) diff --git a/ns3 b/ns3 index 08356fe0b..0867bd4ed 100755 --- a/ns3 +++ b/ns3 @@ -126,7 +126,7 @@ def parse_args(argv): on_off_options = [ ("asserts", "the asserts regardless of the compile mode"), ("des-metrics", "Logging all events in a json file with the name of the executable " - "(which must call CommandLine::Parse(argc, argv)" + "(which must call CommandLine::Parse(argc, argv))" ), ("build-version", "embedding git changes as a build version during build"), ("dpdk", "the fd-net-device DPDK features"), @@ -165,8 +165,8 @@ def parse_args(argv): action="store_true", default=None) parser_configure.add_argument('--lcov-zerocounters', help=('Zero the lcov counters' - '(use this option before rerunning a program' - 'when generating repeated lcov reports)'), + ' (use this option before rerunning a program' + ' when generating repeated lcov reports)'), action="store_true", default=None) parser_configure.add_argument('--out', '--output-directory', @@ -185,7 +185,7 @@ def parse_args(argv): type=str, default=None) parser_configure.add_argument('--force-refresh', help='Force refresh the CMake cache by deleting' - 'the cache and reconfiguring the project', + ' the cache and reconfiguring the project', action="store_true", default=None) parser_configure.add_argument('--prefix', help='Target output directory to install', diff --git a/utils/tests/gitlab-ci-alpine.yml b/utils/tests/gitlab-ci-alpine.yml index ac5b8a7ce..f5c475c95 100644 --- a/utils/tests/gitlab-ci-alpine.yml +++ b/utils/tests/gitlab-ci-alpine.yml @@ -1,7 +1,7 @@ # NS3 CI script for Alpine # Any scheduled pipeline for Alpine should define a variable, named -# "RELEASE", that has a value "weekly". Also, the variale "ALPINE" should be +# "RELEASE", that has a value "weekly". Also, the variable "ALPINE" should be # set to True. # Alpine base diff --git a/utils/tests/gitlab-ci-ubuntu.yml b/utils/tests/gitlab-ci-ubuntu.yml index 4ca4e5d77..a90a3db6c 100644 --- a/utils/tests/gitlab-ci-ubuntu.yml +++ b/utils/tests/gitlab-ci-ubuntu.yml @@ -1,7 +1,7 @@ # NS3 CI script for ubuntu # Any scheduled pipeline for Ubuntu should define a variable, named -# "RELEASE", that has a value "weekly". Also, the variale "UBUNTU" should be +# "RELEASE", that has a value "weekly". Also, the variable "UBUNTU" should be # set to True. # Please take a look at .gitlab-ci.yml to check the dependencies of Ubuntu jobs. diff --git a/utils/tests/test-ns3.py b/utils/tests/test-ns3.py index 1d25adfac..d132e31bc 100644 --- a/utils/tests/test-ns3.py +++ b/utils/tests/test-ns3.py @@ -1199,7 +1199,7 @@ class NS3ConfigureTestCase(NS3BaseTestCase): Test if CMake and ns3 fail in the expected ways when: - examples from modules or general examples fail if they depend on a library with a name shorter than 4 characters or are disabled when - a library is non-existant + a library is nonexistent - a module library passes the configuration but fails to build due to a missing library @return None @@ -1210,7 +1210,7 @@ class NS3ConfigureTestCase(NS3BaseTestCase): # Test if configuration succeeds and building the module library fails with open("contrib/borked/examples/CMakeLists.txt", "w") as f: f.write("") - for invalid_or_non_existant_library in ["", "gsd", "lib", "libfi", "calibre"]: + for invalid_or_nonexistent_library in ["", "gsd", "lib", "libfi", "calibre"]: with open("contrib/borked/CMakeLists.txt", "w") as f: f.write(""" build_lib( @@ -1218,33 +1218,33 @@ class NS3ConfigureTestCase(NS3BaseTestCase): SOURCE_FILES ${PROJECT_SOURCE_DIR}/build-support/empty.cc LIBRARIES_TO_LINK ${libcore} %s ) - """ % invalid_or_non_existant_library) + """ % invalid_or_nonexistent_library) return_code, stdout, stderr = run_ns3("configure -G \"Unix Makefiles\" --enable-examples") - if invalid_or_non_existant_library in ["", "gsd", "libfi", "calibre"]: + if invalid_or_nonexistent_library in ["", "gsd", "libfi", "calibre"]: self.assertEqual(return_code, 0) - elif invalid_or_non_existant_library in ["lib"]: + elif invalid_or_nonexistent_library in ["lib"]: self.assertEqual(return_code, 1) - self.assertIn("Invalid library name: %s" % invalid_or_non_existant_library, stderr) + self.assertIn("Invalid library name: %s" % invalid_or_nonexistent_library, stderr) else: pass return_code, stdout, stderr = run_ns3("build borked") - if invalid_or_non_existant_library in [""]: + if invalid_or_nonexistent_library in [""]: self.assertEqual(return_code, 0) - elif invalid_or_non_existant_library in ["lib"]: + elif invalid_or_nonexistent_library in ["lib"]: self.assertEqual(return_code, 2) # should fail due to invalid library name - self.assertIn("Invalid library name: %s" % invalid_or_non_existant_library, stderr) - elif invalid_or_non_existant_library in ["gsd", "libfi", "calibre"]: + self.assertIn("Invalid library name: %s" % invalid_or_nonexistent_library, stderr) + elif invalid_or_nonexistent_library in ["gsd", "libfi", "calibre"]: self.assertEqual(return_code, 2) # should fail due to missing library - self.assertIn("cannot find -l%s" % invalid_or_non_existant_library, stderr) + self.assertIn("cannot find -l%s" % invalid_or_nonexistent_library, stderr) else: pass # Now test if the example can be built with: # - no additional library (should work) # - invalid library names (should fail to configure) - # - valid library names but inexistent libraries (should not create a target) + # - valid library names but nonexistent libraries (should not create a target) with open("contrib/borked/CMakeLists.txt", "w") as f: f.write(""" build_lib( @@ -1253,7 +1253,7 @@ class NS3ConfigureTestCase(NS3BaseTestCase): LIBRARIES_TO_LINK ${libcore} ) """) - for invalid_or_non_existant_library in ["", "gsd", "lib", "libfi", "calibre"]: + for invalid_or_nonexistent_library in ["", "gsd", "lib", "libfi", "calibre"]: with open("contrib/borked/examples/CMakeLists.txt", "w") as f: f.write(""" build_lib_example( @@ -1261,24 +1261,24 @@ class NS3ConfigureTestCase(NS3BaseTestCase): SOURCE_FILES ${PROJECT_SOURCE_DIR}/build-support/empty-main.cc LIBRARIES_TO_LINK ${libborked} %s ) - """ % invalid_or_non_existant_library) + """ % invalid_or_nonexistent_library) return_code, stdout, stderr = run_ns3("configure -G \"Unix Makefiles\"") - if invalid_or_non_existant_library in ["", "gsd", "libfi", "calibre"]: + if invalid_or_nonexistent_library in ["", "gsd", "libfi", "calibre"]: self.assertEqual(return_code, 0) # should be able to configure - elif invalid_or_non_existant_library in ["lib"]: + elif invalid_or_nonexistent_library in ["lib"]: self.assertEqual(return_code, 1) # should fail to even configure - self.assertIn("Invalid library name: %s" % invalid_or_non_existant_library, stderr) + self.assertIn("Invalid library name: %s" % invalid_or_nonexistent_library, stderr) else: pass return_code, stdout, stderr = run_ns3("build borked-example") - if invalid_or_non_existant_library in [""]: + if invalid_or_nonexistent_library in [""]: self.assertEqual(return_code, 0) # should be able to build - elif invalid_or_non_existant_library in ["libf"]: + elif invalid_or_nonexistent_library in ["libf"]: self.assertEqual(return_code, 2) # should fail due to missing configuration - self.assertIn("Invalid library name: %s" % invalid_or_non_existant_library, stderr) - elif invalid_or_non_existant_library in ["gsd", "libfi", "calibre"]: + self.assertIn("Invalid library name: %s" % invalid_or_nonexistent_library, stderr) + elif invalid_or_nonexistent_library in ["gsd", "libfi", "calibre"]: self.assertEqual(return_code, 1) # should fail to find target self.assertIn("Target to build does not exist: borked-example", stdout) else: @@ -1361,10 +1361,15 @@ class NS3ConfigureTestCase(NS3BaseTestCase): del docker_settings, setting, key, value # Create Docker client instance and start it - with docker.run("ubuntu:22.04", interactive=True, detach=True, tty=False, volumes=[(ns3_path, "/ns-3-dev")]) as container: + with docker.run("ubuntu:22.04", + interactive=True, detach=True, + tty=False, + volumes=[(ns3_path, "/ns-3-dev")] + ) as container: # Redefine the execute command of the container def split_exec(self, cmd): return self._execute(cmd.split(), workdir="/ns-3-dev") + container._execute = container.execute container.execute = partial(split_exec, container) @@ -2176,7 +2181,7 @@ class NS3ExpectedUseTestCase(NS3BaseTestCase): return_code, stdout, stderr = run_ns3('configure --enable-sudo') self.assertEqual(return_code, 0) - # Check if it was properly set in the buildstatus file + # Check if it was properly set in the lock file enable_sudo = read_lock_entry("ENABLE_SUDO") self.assertTrue(enable_sudo) @@ -2383,7 +2388,8 @@ class NS3QualityControlTestCase(unittest.TestCase): # User agent string to make ACM and Elsevier let us check if links to papers are working headers = { - 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'} + 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36' + } def test_file_url(args): filepath, url = args