[PATCH] Eliminate config.inc.

Christian Mauderer christian.mauderer at embedded-brains.de
Mon Mar 19 15:16:21 UTC 2018


Most of the values in config.inc haven't been used any more. The only
part left has been the ip addresses for some of the test. All other
values are not used and might irritate new users.

Generating the header for the network configuration adds quite some
lines to the build system. On the other side it seems not really that
necessary to make the network configuration for the tests configurable.
Therefore this patch elimintates that too and uses fixed IP addresses in
the (previously generated) network-config.h header instead. If someone
really needs to run the tests with some other IP addresses, he still can
locally change the header (instead of the config.inc).
---
 config.inc                                         | 15 --------
 libbsd.txt                                         | 30 +++------------
 libbsd_waf.py                                      | 36 -----------------
 .../test/{network-config.h.in => network-config.h} |  8 ++--
 waf_generator.py                                   | 45 ----------------------
 wscript                                            |  5 ---
 6 files changed, 10 insertions(+), 129 deletions(-)
 delete mode 100644 config.inc
 rename testsuite/include/rtems/bsd/test/{network-config.h.in => network-config.h} (92%)

diff --git a/config.inc b/config.inc
deleted file mode 100644
index 3432a5fc..00000000
--- a/config.inc
+++ /dev/null
@@ -1,15 +0,0 @@
-# Mandatory: Select your BSP and installation prefix
-TARGET = arm-rtems4.11
-BSP = realview_pbx_a9_qemu
-PREFIX = /opt/rtems-4.11
-
-# Optional: Separate installation base directory
-INSTALL_BASE = $(PREFIX)/$(TARGET)/$(BSP)
-
-# Optional: Network test configuration
-TEST_RUNNER = $(BSP)
-NET_CFG_SELF_IP = 10.0.2.1
-NET_CFG_NETMASK = 255.255.0.0
-NET_CFG_PEER_IP = 192.168.100.11
-NET_CFG_GATEWAY_IP = 192.168.100.11
-NET_TAP_INTERFACE = tap0
diff --git a/libbsd.txt b/libbsd.txt
index 71d5cc8d..d57d1884 100644
--- a/libbsd.txt
+++ b/libbsd.txt
@@ -42,7 +42,6 @@ installed.
 
 . Clone the Git repository +git clone git://git.rtems.org/rtems-libbsd.git+.
 . Change into the RTEMS BSD library root directory.
-. Edit the `config.inc` configuration file and adjust it to your environment.
 . Run +waf configure ...+.
 . Run +waf+.
 . Run +waf install+.
@@ -119,29 +118,6 @@ devices (you can run multiple test instances on one virtual network).
 The build system based on the Waf build system. To build with Waf please refer
 to the README.waf file.
 
-===== Example Configuration =====
-
-In the BSD library source directory edit the file `config.inc`.  Continuing on
-the above, the `config.inc` used to match the above is:
-
--------------------------------------------------------------------------------
-# Mandatory: Select your BSP and installation prefix
-TARGET = arm-rtems4.12
-BSP = xilinx_zynq_a9_qemu
-PREFIX = $(HOME)/sandbox/install
-
-# Optional: Separate installation base directory
-INSTALL_BASE = $(PREFIX)/$(TARGET)/$(BSP)
-
-# Optional: Network test configuration
-TEST_RUNNER = $(BSP)
-NET_CFG_SELF_IP = 10.0.0.2
-NET_CFG_NETMASK = 255.255.0.0
-NET_CFG_PEER_IP = 10.0.0.1
-NET_CFG_GATEWAY_IP = 10.0.0.1
-NET_TAP_INTERFACE = tap0
--------------------------------------------------------------------------------
-
 === BSD Library Initialization ===
 
 To initialise the BSD Library create a suitable rc.conf file. The FreeBSD man
@@ -273,6 +249,12 @@ their own implementation of the `rtems_bsd_get_allocator_domain_size()`
 function (for example in the module which calls `rtems_bsd_initialize()`) if
 different values are desired.  The default size is 8MiB for all domains.
 
+=== Tests ===
+
+There are tests for some features in the `testsuite` directory. Note that some
+of the tests use a fixed IP configuration that is defined in
+`testsuite/include/rtems/bsd/test/network-config.h`.
+
 == Network Stack Features
 
 http://roy.marples.name/projects/dhcpcd/index[DHCPCD(8)]:: DHCP client
diff --git a/libbsd_waf.py b/libbsd_waf.py
index 745512bf..642142e2 100644
--- a/libbsd_waf.py
+++ b/libbsd_waf.py
@@ -91,42 +91,6 @@ def build(bld):
     # Collect the libbsd uses
     libbsd_use = []
 
-    # Network test configuration
-    if not os.path.exists(bld.env.NET_CONFIG):
-        bld.fatal("network configuraiton '%s' not found" % (bld.env.NET_CONFIG))
-    net_cfg_self_ip = None
-    net_cfg_netmask = None
-    net_cfg_peer_ip = None
-    net_cfg_gateway_ip = None
-    net_tap_interface = None
-    try:
-        net_cfg_lines = open(bld.env.NET_CONFIG).readlines()
-    except:
-        bld.fatal("network configuraiton '%s' read failed" % (bld.env.NET_CONFIG))
-    lc = 0
-    for l in net_cfg_lines:
-        lc += 1
-        if l.strip().startswith("NET_CFG_"):
-            ls = l.split("=")
-            if len(ls) != 2:
-                bld.fatal("network configuraiton '%s' parse error: %d: %s" % (bld.env.NET_CONFIG, lc, l))
-            lhs = ls[0].strip()
-            rhs = ls[1].strip()
-            if lhs == "NET_CFG_SELF_IP":
-                net_cfg_self_ip = rhs
-            if lhs == "NET_CFG_NETMASK":
-                net_cfg_netmask = rhs
-            if lhs == "NET_CFG_PEER_IP":
-                net_cfg_peer_ip = rhs
-            if lhs == "NET_CFG_GATEWAY_IP":
-                net_cfg_gateway_ip = rhs
-            if lhs == "NET_TAP_INTERFACE":
-                net_tap_interface = rhs
-    bld(target = "testsuite/include/rtems/bsd/test/network-config.h",
-        source = "testsuite/include/rtems/bsd/test/network-config.h.in",
-        rule = "sed -e 's/@NET_CFG_SELF_IP@/%s/' -e 's/@NET_CFG_NETMASK@/%s/' -e 's/@NET_CFG_PEER_IP@/%s/' -e 's/@NET_CFG_GATEWAY_IP@/%s/' < ${SRC} > ${TGT}" % (net_cfg_self_ip, net_cfg_netmask, net_cfg_peer_ip, net_cfg_gateway_ip),
-        update_outputs = True)
-
     # copy headers if necessary
     header_build_copy_paths = [
                                ('freebsd/crypto/openssl/crypto', '*.h', 'openssl'),
diff --git a/testsuite/include/rtems/bsd/test/network-config.h.in b/testsuite/include/rtems/bsd/test/network-config.h
similarity index 92%
rename from testsuite/include/rtems/bsd/test/network-config.h.in
rename to testsuite/include/rtems/bsd/test/network-config.h
index 2cef97db..c7350011 100755
--- a/testsuite/include/rtems/bsd/test/network-config.h.in
+++ b/testsuite/include/rtems/bsd/test/network-config.h
@@ -54,12 +54,12 @@
   #define NET_CFG_INTERFACE_0 "lo0"
 #endif
 
-#define NET_CFG_SELF_IP "@NET_CFG_SELF_IP@"
+#define NET_CFG_SELF_IP "10.0.2.1"
 
-#define NET_CFG_NETMASK "@NET_CFG_NETMASK@"
+#define NET_CFG_NETMASK "255.255.0.0"
 
-#define NET_CFG_PEER_IP "@NET_CFG_PEER_IP@"
+#define NET_CFG_PEER_IP "192.168.100.11"
 
-#define NET_CFG_GATEWAY_IP "@NET_CFG_GATEWAY_IP@"
+#define NET_CFG_GATEWAY_IP "192.168.100.11"
 
 #endif /* _RTEMS_BSD_TEST_NETWORK_CONFIG_H_ */
diff --git a/waf_generator.py b/waf_generator.py
index 73b02a83..fdda0e54 100755
--- a/waf_generator.py
+++ b/waf_generator.py
@@ -407,51 +407,6 @@ class ModuleManager(builder.ModuleManager):
         self.add('')
 
         #
-        # Support the existing Makefile based network configuration file.
-        #
-        self.add('    # Network test configuration')
-        self.add('    if not os.path.exists(bld.env.NET_CONFIG):')
-        self.add('        bld.fatal("network configuraiton \'%s\' not found" % (bld.env.NET_CONFIG))')
-        self.add('    net_cfg_self_ip = None')
-        self.add('    net_cfg_netmask = None')
-        self.add('    net_cfg_peer_ip = None')
-        self.add('    net_cfg_gateway_ip = None')
-        self.add('    net_tap_interface = None')
-        self.add('    try:')
-        self.add('        net_cfg_lines = open(bld.env.NET_CONFIG).readlines()')
-        self.add('    except:')
-        self.add('        bld.fatal("network configuraiton \'%s\' read failed" % (bld.env.NET_CONFIG))')
-        self.add('    lc = 0')
-        self.add('    for l in net_cfg_lines:')
-        self.add('        lc += 1')
-        self.add('        if l.strip().startswith("NET_CFG_"):')
-        self.add('            ls = l.split("=")')
-        self.add('            if len(ls) != 2:')
-        self.add('                bld.fatal("network configuraiton \'%s\' parse error: %d: %s" % ' + \
-                 '(bld.env.NET_CONFIG, lc, l))')
-        self.add('            lhs = ls[0].strip()')
-        self.add('            rhs = ls[1].strip()')
-        self.add('            if lhs == "NET_CFG_SELF_IP":')
-        self.add('                net_cfg_self_ip = rhs')
-        self.add('            if lhs == "NET_CFG_NETMASK":')
-        self.add('                net_cfg_netmask = rhs')
-        self.add('            if lhs == "NET_CFG_PEER_IP":')
-        self.add('                net_cfg_peer_ip = rhs')
-        self.add('            if lhs == "NET_CFG_GATEWAY_IP":')
-        self.add('                net_cfg_gateway_ip = rhs')
-        self.add('            if lhs == "NET_TAP_INTERFACE":')
-        self.add('                net_tap_interface = rhs')
-        self.add('    bld(target = "testsuite/include/rtems/bsd/test/network-config.h",')
-        self.add('        source = "testsuite/include/rtems/bsd/test/network-config.h.in",')
-        self.add('        rule = "sed -e \'s/@NET_CFG_SELF_IP@/%s/\' ' + \
-                 '-e \'s/@NET_CFG_NETMASK@/%s/\' ' + \
-                 '-e \'s/@NET_CFG_PEER_IP@/%s/\' ' + \
-                 '-e \'s/@NET_CFG_GATEWAY_IP@/%s/\' < ${SRC} > ${TGT}" % ' + \
-                 '(net_cfg_self_ip, net_cfg_netmask, net_cfg_peer_ip, net_cfg_gateway_ip),')
-        self.add('        update_outputs = True)')
-        self.add('')
-
-        #
         # Add a copy rule for all headers where the install path and the source
         # path are not the same.
         #
diff --git a/wscript b/wscript
index f176cbb9..f4f9fd33 100644
--- a/wscript
+++ b/wscript
@@ -59,10 +59,6 @@ def options(opt):
                    default = False,
                    dest = "warnings",
                    help = "Enable all warnings. The default is quiet builds.")
-    opt.add_option("--net-test-config",
-                   default = "config.inc",
-                   dest = "net_config",
-                   help = "Network test configuration.")
     opt.add_option("--freebsd-options",
                    action = "store",
                    default = "",
@@ -91,7 +87,6 @@ def configure(conf):
         conf.find_program("yacc", mandatory = True)
     conf.env.AUTO_REGEN = conf.options.auto_regen
     conf.env.WARNINGS = conf.options.warnings
-    conf.env.NET_CONFIG = conf.options.net_config
     conf.env.FREEBSD_OPTIONS =conf.options.freebsd_options
     conf.env.OPTIMIZATION = conf.options.optimization
     rtems.configure(conf, bsp_configure)
-- 
2.13.6



More information about the devel mailing list