Make test.py handle examples-to-run.py files default tip
authorMitch Watrous <watrous@u.washington.edu>
Sat, 12 Feb 2011 16:48:54 -0800
changeset 6826 febb06ddcd0f
parent 6825 ff0d7d1ad35f
Make test.py handle examples-to-run.py files
examples/csma/examples-to-run.py
examples/emulation/examples-to-run.py
examples/error-model/examples-to-run.py
examples/ipv6/examples-to-run.py
examples/mesh/examples-to-run.py
examples/naming/examples-to-run.py
examples/realtime/examples-to-run.py
examples/routing/examples-to-run.py
examples/stats/examples-to-run.py
examples/tap/examples-to-run.py
examples/tcp/examples-to-run.py
examples/topology-read/examples-to-run.py
examples/tutorial/examples-to-run.py
examples/udp/examples-to-run.py
examples/wimax/examples-to-run.py
examples/wireless/examples-to-run.py
src/spectrum/test/examples-to-run.py
test.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/csma/examples-to-run.py	Sat Feb 12 16:48:54 2011 -0800
@@ -0,0 +1,26 @@
+#! /usr/bin/env python
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+# A list of C++ examples to run in order to ensure that they remain
+# buildable and runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run, do_valgrind_run).
+#
+# See test.py for more information.
+cpp_examples = [
+    ("csma-broadcast", "True", "True"),
+    ("csma-multicast", "True", "True"),
+    ("csma-one-subnet", "True", "True"),
+    ("csma-packet-socket", "True", "True"),
+    ("csma-ping", "True", "True"),
+    ("csma-raw-ip-socket", "True", "True"),
+    ("csma-star", "True", "True"),
+]
+
+# A list of Python examples to run in order to ensure that they remain
+# runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run).
+#
+# See test.py for more information.
+python_examples = []
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/emulation/examples-to-run.py	Sat Feb 12 16:48:54 2011 -0800
@@ -0,0 +1,21 @@
+#! /usr/bin/env python
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+# A list of C++ examples to run in order to ensure that they remain
+# buildable and runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run, do_valgrind_run).
+#
+# See test.py for more information.
+cpp_examples = [
+    ("emu-ping", "False", "True"),
+    ("emu-udp-echo", "False", "True"),
+]
+
+# A list of Python examples to run in order to ensure that they remain
+# runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run).
+#
+# See test.py for more information.
+python_examples = []
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/error-model/examples-to-run.py	Sat Feb 12 16:48:54 2011 -0800
@@ -0,0 +1,20 @@
+#! /usr/bin/env python
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+# A list of C++ examples to run in order to ensure that they remain
+# buildable and runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run, do_valgrind_run).
+#
+# See test.py for more information.
+cpp_examples = [
+    ("simple-error-model", "True", "True"),
+]
+
+# A list of Python examples to run in order to ensure that they remain
+# runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run).
+#
+# See test.py for more information.
+python_examples = []
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/ipv6/examples-to-run.py	Sat Feb 12 16:48:54 2011 -0800
@@ -0,0 +1,24 @@
+#! /usr/bin/env python
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+# A list of C++ examples to run in order to ensure that they remain
+# buildable and runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run, do_valgrind_run).
+#
+# See test.py for more information.
+cpp_examples = [
+    ("icmpv6-redirect", "True", "True"),
+    ("ping6", "True", "True"),
+    ("radvd", "True", "True"),
+    ("radvd-two-prefix", "True", "True"),    
+    ("test-ipv6", "True", "True"),
+]
+
+# A list of Python examples to run in order to ensure that they remain
+# runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run).
+#
+# See test.py for more information.
+python_examples = []
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/mesh/examples-to-run.py	Sat Feb 12 16:48:54 2011 -0800
@@ -0,0 +1,20 @@
+#! /usr/bin/env python
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+# A list of C++ examples to run in order to ensure that they remain
+# buildable and runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run, do_valgrind_run).
+#
+# See test.py for more information.
+cpp_examples = [
+    ("mesh", "True", "True"),
+]
+
+# A list of Python examples to run in order to ensure that they remain
+# runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run).
+#
+# See test.py for more information.
+python_examples = []
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/naming/examples-to-run.py	Sat Feb 12 16:48:54 2011 -0800
@@ -0,0 +1,20 @@
+#! /usr/bin/env python
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+# A list of C++ examples to run in order to ensure that they remain
+# buildable and runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run, do_valgrind_run).
+#
+# See test.py for more information.
+cpp_examples = [
+    ("object-names", "True", "True"),
+]
+
+# A list of Python examples to run in order to ensure that they remain
+# runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run).
+#
+# See test.py for more information.
+python_examples = []
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/realtime/examples-to-run.py	Sat Feb 12 16:48:54 2011 -0800
@@ -0,0 +1,21 @@
+
+#! /usr/bin/env python
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+# A list of C++ examples to run in order to ensure that they remain
+# buildable and runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run, do_valgrind_run).
+#
+# See test.py for more information.
+cpp_examples = [
+    ("realtime-udp-echo", "ENABLE_REAL_TIME == True", "True"),
+]
+
+# A list of Python examples to run in order to ensure that they remain
+# runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run).
+#
+# See test.py for more information.
+python_examples = []
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/routing/examples-to-run.py	Sat Feb 12 16:48:54 2011 -0800
@@ -0,0 +1,32 @@
+#! /usr/bin/env python
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+# A list of C++ examples to run in order to ensure that they remain
+# buildable and runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run, do_valgrind_run).
+#
+# See test.py for more information.
+cpp_examples = [
+    ("dynamic-global-routing", "True", "True"),
+    ("global-injection-slash32", "True", "True"),
+    ("global-routing-slash32", "True", "True"),
+    ("mixed-global-routing", "True", "True"),
+    ("nix-simple", "True", "True"),
+    ("nms-p2p-nix", "False", "True"), # Takes too long to run
+    ("simple-alternate-routing", "True", "True"),
+    ("simple-global-routing", "True", "True"),
+    ("simple-routing-ping6", "True", "True"),
+    ("static-routing-slash32", "True", "True"),
+    ("aodv", "True", "True"),
+]
+
+# A list of Python examples to run in order to ensure that they remain
+# runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run).
+#
+# See test.py for more information.
+python_examples = [
+    ("simple-routing-ping6.py", "True"),
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/stats/examples-to-run.py	Sat Feb 12 16:48:54 2011 -0800
@@ -0,0 +1,20 @@
+#! /usr/bin/env python
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+# A list of C++ examples to run in order to ensure that they remain
+# buildable and runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run, do_valgrind_run).
+#
+# See test.py for more information.
+cpp_examples = [
+    ("wifi-example-sim", "True", "True"),
+]
+
+# A list of Python examples to run in order to ensure that they remain
+# runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run).
+#
+# See test.py for more information.
+python_examples = []
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/tap/examples-to-run.py	Sat Feb 12 16:48:54 2011 -0800
@@ -0,0 +1,23 @@
+#! /usr/bin/env python
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+# A list of C++ examples to run in order to ensure that they remain
+# buildable and runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run, do_valgrind_run).
+#
+# See test.py for more information.
+cpp_examples = [
+    ("tap-wifi-dumbbell", "False", "True"), # Requires manual configuration
+]
+
+# A list of Python examples to run in order to ensure that they remain
+# runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run).
+#
+# See test.py for more information.
+python_examples = [
+    ("tap-csma-virtual-machine.py", "False"), # requires enable-sudo
+    ("tap-wifi-virtual-machine.py", "False"), # requires enable-sudo
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/tcp/examples-to-run.py	Sat Feb 12 16:48:54 2011 -0800
@@ -0,0 +1,24 @@
+#! /usr/bin/env python
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+# A list of C++ examples to run in order to ensure that they remain
+# buildable and runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run, do_valgrind_run).
+#
+# See test.py for more information.
+cpp_examples = [
+    ("star", "True", "True"),
+    ("tcp-large-transfer", "True", "True"),
+    ("tcp-nsc-lfn", "NSC_ENABLED == True", "False"),
+    ("tcp-nsc-zoo", "NSC_ENABLED == True", "False"),
+    ("tcp-star-server", "True", "True"),
+]
+
+# A list of Python examples to run in order to ensure that they remain
+# runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run).
+#
+# See test.py for more information.
+python_examples = []
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/topology-read/examples-to-run.py	Sat Feb 12 16:48:54 2011 -0800
@@ -0,0 +1,21 @@
+#! /usr/bin/env python
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+# A list of C++ examples to run in order to ensure that they remain
+# buildable and runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run, do_valgrind_run).
+#
+# See test.py for more information.
+cpp_examples = [
+    ("Inet_small_toposample.txt", "True", "True"),
+    ("RocketFuel_toposample_1239_weights.txt", "True", "True"),
+]
+
+# A list of Python examples to run in order to ensure that they remain
+# runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run).
+#
+# See test.py for more information.
+python_examples = []
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/tutorial/examples-to-run.py	Sat Feb 12 16:48:54 2011 -0800
@@ -0,0 +1,28 @@
+#! /usr/bin/env python
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+# A list of C++ examples to run in order to ensure that they remain
+# buildable and runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run, do_valgrind_run).
+#
+# See test.py for more information.
+cpp_examples = [
+    ("first", "True", "True"),
+    ("hello-simulator", "True", "True"),
+    ("second", "True", "True"),
+    ("third", "True", "True"),
+    ("fourth", "True", "True"),
+    ("fifth", "True", "True"),
+    ("sixth", "True", "True"),
+]
+
+# A list of Python examples to run in order to ensure that they remain
+# runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run).
+#
+# See test.py for more information.
+python_examples = [
+    ("first.py", "True"),
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/udp/examples-to-run.py	Sat Feb 12 16:48:54 2011 -0800
@@ -0,0 +1,21 @@
+
+#! /usr/bin/env python
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+# A list of C++ examples to run in order to ensure that they remain
+# buildable and runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run, do_valgrind_run).
+#
+# See test.py for more information.
+cpp_examples = [
+    ("udp-echo", "True", "True"),
+]
+
+# A list of Python examples to run in order to ensure that they remain
+# runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run).
+#
+# See test.py for more information.
+python_examples = []
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/wimax/examples-to-run.py	Sat Feb 12 16:48:54 2011 -0800
@@ -0,0 +1,22 @@
+#! /usr/bin/env python
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+# A list of C++ examples to run in order to ensure that they remain
+# buildable and runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run, do_valgrind_run).
+#
+# See test.py for more information.
+cpp_examples = [
+    ("wimax-simple", "True", "True"),
+    ("wimax-ipv4", "True", "True"),
+    ("wimax-multicast", "True", "True"),
+]
+
+# A list of Python examples to run in order to ensure that they remain
+# runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run).
+#
+# See test.py for more information.
+python_examples = []
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/wireless/examples-to-run.py	Sat Feb 12 16:48:54 2011 -0800
@@ -0,0 +1,39 @@
+#! /usr/bin/env python
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+# A list of C++ examples to run in order to ensure that they remain
+# buildable and runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run, do_valgrind_run).
+#
+# See test.py for more information.
+cpp_examples = [
+    ("mixed-wireless", "True", "True"),
+    ("multirate --totalTime=0.3s --rateManager=ns3::AarfcdWifiManager", "True", "True"), 
+    ("multirate --totalTime=0.3s --rateManager=ns3::AmrrWifiManager", "True", "True"), 
+    ("multirate --totalTime=0.3s --rateManager=ns3::CaraWifiManager", "True", "True"), 
+    ("multirate --totalTime=0.3s --rateManager=ns3::IdealWifiManager", "True", "True"), 
+    ("multirate --totalTime=0.3s --rateManager=ns3::MinstrelWifiManager", "True", "True"), 
+    ("multirate --totalTime=0.3s --rateManager=ns3::OnoeWifiManager", "True", "True"), 
+    ("multirate --totalTime=0.3s --rateManager=ns3::RraaWifiManager", "True", "True"), 
+    ("simple-wifi-frame-aggregation", "True", "True"),
+    ("wifi-adhoc", "False", "True"), # Takes too long to run
+    ("wifi-ap --verbose=0", "True", "True"), # Don't let it spew to stdout
+    ("wifi-clear-channel-cmu", "False", "True"), # Requires specific hardware
+    ("wifi-simple-adhoc", "True", "True"),
+    ("wifi-simple-adhoc-grid", "True", "True"),
+    ("wifi-simple-infra", "True", "True"),
+    ("wifi-simple-interference", "True", "True"),
+    ("wifi-wired-bridging", "True", "True"),
+]
+
+# A list of Python examples to run in order to ensure that they remain
+# runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run).
+#
+# See test.py for more information.
+python_examples = [
+    ("wifi-ap.py", "True"),
+    ("mixed-wireless.py", "True"),
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/spectrum/test/examples-to-run.py	Sat Feb 12 16:48:54 2011 -0800
@@ -0,0 +1,22 @@
+
+#! /usr/bin/env python
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+# A list of C++ examples to run in order to ensure that they remain
+# buildable and runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run, do_valgrind_run).
+#
+# See test.py for more information.
+cpp_examples = [
+    ("adhoc-aloha-ideal-phy", "True", "True"),
+    ("adhoc-aloha-ideal-phy-with-microwave-oven", "True", "True"),
+]
+
+# A list of Python examples to run in order to ensure that they remain
+# runnable over time.  Each tuple in the list contains
+#
+#     (example_name, do_run).
+#
+# See test.py for more information.
+python_examples = []
--- a/test.py	Sat Feb 12 15:34:58 2011 -0800
+++ b/test.py	Sat Feb 12 16:48:54 2011 -0800
@@ -29,6 +29,8 @@
 import shutil
 import re
 
+from util import get_list_from_file
+
 #
 # XXX This should really be part of a waf command to list the configuration
 # items relative to optional ns-3 pieces.
@@ -41,16 +43,19 @@
 #
 interesting_config_items = [
     "NS3_BUILDDIR",
+    "NS3_ENABLED_MODULES",
     "NS3_MODULE_PATH",
     "NSC_ENABLED",
     "ENABLE_REAL_TIME",
     "ENABLE_EXAMPLES",
+    "EXAMPLE_DIRECTORIES",
     "ENABLE_PYTHON_BINDINGS",
 ]
 
 NSC_ENABLED = False
 ENABLE_REAL_TIME = False
 ENABLE_EXAMPLES = True
+EXAMPLE_DIRECTORIES = []
 
 #
 # If the user has constrained us to run certain kinds of tests, we can tell waf
@@ -79,132 +84,63 @@
 ]
 
 #
-# A list of examples to run as smoke tests just to ensure that they remain 
-# buildable and runnable over time.  Also a condition under which to run
-# the example (from the waf configuration), and a condition under which to
-# run the example under valgrind.  This is because NSC causes illegal 
-# instruction crashes when run under valgrind.
+# Parse the examples-to-run file if it exists.
 #
-# XXX Should this not be read from a configuration file somewhere and not
-# hardcoded.
+# This function adds any C++ examples or Python examples that are to be run
+# to the lists in example_tests and python_tests, respectively.
 #
-example_tests = [
-    ("examples/csma/csma-bridge", "True", "True"),
-    ("examples/csma/csma-bridge-one-hop", "True", "True"),
-    ("examples/csma/csma-broadcast", "True", "True"),
-    ("examples/csma/csma-multicast", "True", "True"),
-    ("examples/csma/csma-one-subnet", "True", "True"),
-    ("examples/csma/csma-packet-socket", "True", "True"),
-    ("examples/csma/csma-ping", "True", "True"),
-    ("examples/csma/csma-raw-ip-socket", "True", "True"),
-    ("examples/csma/csma-star", "True", "True"),
-
-    ("examples/emulation/emu-ping", "False", "True"),
-    ("examples/emulation/emu-udp-echo", "False", "True"),
-
-    ("examples/energy/energy-model-example", "True", "True"),
-
-    ("examples/error-model/simple-error-model", "True", "True"),
+def parse_examples_to_run_file(
+    examples_to_run_path,
+    cpp_executable_dir,
+    python_script_dir,
+    example_tests,
+    python_tests):
 
-    ("examples/ipv6/icmpv6-redirect", "True", "True"),
-    ("examples/ipv6/ping6", "True", "True"),
-    ("examples/ipv6/radvd", "True", "True"),
-    ("examples/ipv6/radvd-two-prefix", "True", "True"),    
-    ("examples/ipv6/test-ipv6", "True", "True"),
-
-    ("examples/mesh/mesh", "True", "True"),
-
-    ("examples/naming/object-names", "True", "True"),
-
-    ("examples/realtime/realtime-udp-echo", "ENABLE_REAL_TIME == True", "True"),
-
-    ("examples/routing/dynamic-global-routing", "True", "True"),
-    ("examples/routing/global-injection-slash32", "True", "True"),
-    ("examples/routing/global-routing-slash32", "True", "True"),
-    ("examples/routing/mixed-global-routing", "True", "True"),
-    ("examples/routing/nix-simple", "True", "True"),
-    ("examples/routing/nms-p2p-nix", "False", "True"), # Takes too long to run
-    ("examples/routing/simple-alternate-routing", "True", "True"),
-    ("examples/routing/simple-global-routing", "True", "True"),
-    ("src/routing/olsr/examples/simple-point-to-point-olsr", "True", "True"),
-    ("examples/routing/simple-routing-ping6", "True", "True"),
-    ("examples/routing/static-routing-slash32", "True", "True"),
-    ("examples/routing/aodv", "True", "True"),
-
-    ("src/spectrum/examples/adhoc-aloha-ideal-phy", "True", "True"),
-    ("src/spectrum/examples/adhoc-aloha-ideal-phy-with-microwave-oven", "True", "True"),
-
-    ("examples/stats/wifi-example-sim", "True", "True"),
-
-    ("examples/tap/tap-wifi-dumbbell", "False", "True"), # Requires manual configuration
+    # Look for the examples-to-run file exists.
+    if os.path.exists(examples_to_run_path):
 
-    ("examples/tcp/star", "True", "True"),
-    ("examples/tcp/tcp-large-transfer", "True", "True"),
-    ("examples/tcp/tcp-nsc-lfn", "NSC_ENABLED == True", "False"),
-    ("examples/tcp/tcp-nsc-zoo", "NSC_ENABLED == True", "False"),
-    ("examples/tcp/tcp-star-server", "True", "True"),
-
-    ("examples/topology-read/topology-read --input=../../examples/topology-read/Inet_small_toposample.txt", "True", "True"),
-    ("examples/topology-read/topology-read --format=Rocketfuel --input=../../examples/topology-read/RocketFuel_toposample_1239_weights.txt", "True", "True"),
-
-    ("src/devices/virtual-net-device/examples/virtual-net-device", "True", "True"),
-
-    ("examples/tutorial/first", "True", "True"),
-    ("examples/tutorial/hello-simulator", "True", "True"),
-    ("examples/tutorial/second", "True", "True"),
-    ("examples/tutorial/third", "True", "True"),
-    ("examples/tutorial/fourth", "True", "True"),
-    ("examples/tutorial/fifth", "True", "True"),
-    ("examples/tutorial/sixth", "True", "True"),
-
-    ("examples/udp/udp-echo", "True", "True"),
+        # Each tuple in the C++ list of examples to run contains
+        #
+        #     (example_name, do_run, do_valgrind_run)
+        #
+        # where example_name is the executable to be run, do_run is a
+        # condition under which to run the example, and do_valgrind_run is
+        # a condition under which to run the example under valgrind.  This
+        # is needed because NSC causes illegal instruction crashes with
+        # some tests when they are run under valgrind.
+        #
+        # Note that the two conditions are Python statements that
+        # can depend on waf configuration variables.  For example,
+        #
+        #     ("tcp-nsc-lfn", "NSC_ENABLED == True", "NSC_ENABLED == False"),
+        #
+        cpp_examples = get_list_from_file(examples_to_run_path, "cpp_examples")
+        for example_name, do_run, do_valgrind_run in cpp_examples:
+            example_path = os.path.join(cpp_executable_dir, example_name)
+            # Add all of the C++ examples that were built, i.e. found
+            # in the directory, to the list of C++ examples to run.
+            if os.path.exists(example_path):
+                example_tests.append((example_path, do_run, do_valgrind_run))
 
-    ("examples/wireless/mixed-wireless", "True", "True"),
-    ("examples/wireless/multirate --totalTime=0.3s --rateManager=ns3::AarfcdWifiManager", "True", "True"), 
-    ("examples/wireless/multirate --totalTime=0.3s --rateManager=ns3::AmrrWifiManager", "True", "True"), 
-    ("examples/wireless/multirate --totalTime=0.3s --rateManager=ns3::CaraWifiManager", "True", "True"), 
-    ("examples/wireless/multirate --totalTime=0.3s --rateManager=ns3::IdealWifiManager", "True", "True"), 
-    ("examples/wireless/multirate --totalTime=0.3s --rateManager=ns3::MinstrelWifiManager", "True", "True"), 
-    ("examples/wireless/multirate --totalTime=0.3s --rateManager=ns3::OnoeWifiManager", "True", "True"), 
-    ("examples/wireless/multirate --totalTime=0.3s --rateManager=ns3::RraaWifiManager", "True", "True"), 
-    ("examples/wireless/simple-wifi-frame-aggregation", "True", "True"),
-    ("examples/wireless/wifi-adhoc", "False", "True"), # Takes too long to run
-    ("examples/wireless/wifi-ap --verbose=0", "True", "True"), # Don't let it spew to stdout
-    ("examples/wireless/wifi-clear-channel-cmu", "False", "True"), # Requires specific hardware
-    ("examples/wireless/wifi-simple-adhoc", "True", "True"),
-    ("examples/wireless/wifi-simple-adhoc-grid", "True", "True"),
-    ("examples/wireless/wifi-simple-infra", "True", "True"),
-    ("examples/wireless/wifi-simple-interference", "True", "True"),
-    ("examples/wireless/wifi-wired-bridging", "True", "True"),
-
-    ("examples/wimax/wimax-simple", "True", "True"),
-    ("examples/wimax/wimax-ipv4", "True", "True"),
-    ("examples/wimax/wimax-multicast", "True", "True"),
-]
-
-#
-# A list of python examples to run as smoke tests just to ensure that they 
-# runnable over time.  Also a condition under which to run the example (from
-# the waf configuration)
-#
-# XXX Should this not be read from a configuration file somewhere and not
-# hardcoded.
-#
-python_tests = [
-    ("examples/csma/csma-bridge.py", "True"),
-
-    ("src/contrib/flow-monitor/examples/wifi-olsr-flowmon.py", "True"),
-
-    ("examples/routing/simple-routing-ping6.py", "True"),
-
-    ("examples/tap/tap-csma-virtual-machine.py", "False"), # requires enable-sudo
-    ("examples/tap/tap-wifi-virtual-machine.py", "False"), # requires enable-sudo
-
-    ("examples/tutorial/first.py", "True"),
-
-    ("examples/wireless/wifi-ap.py", "True"),
-    ("examples/wireless/mixed-wireless.py", "True"),
-]
+        # Each tuple in the Python list of examples to run contains
+        #
+        #     (example_name, do_run)
+        #
+        # where example_name is the Python script to be run and
+        # do_run is a condition under which to run the example.
+        #
+        # Note that the condition is a Python statement that can
+        # depend on waf configuration variables.  For example,
+        #
+        #     ("realtime-udp-echo.py", "ENABLE_REAL_TIME == True"),
+        #
+        python_examples = get_list_from_file(examples_to_run_path, "python_examples")
+        for example_name, do_run in python_examples:
+            example_path = os.path.join(python_script_dir, example_name)
+            # Add all of the Python examples that were found to the
+            # list of Python examples to run.
+            if os.path.exists(example_path):
+                python_tests.append((example_path, do_run))
 
 #
 # The test suites are going to want to output status.  They are running
@@ -1039,6 +975,64 @@
     read_waf_config()
     make_paths()
 
+    # Generate the lists of examples to run as smoke tests in order to
+    # ensure that they remain buildable and runnable over time.
+    #
+    example_tests = []
+    python_tests = []
+    for directory in EXAMPLE_DIRECTORIES:
+        # Set the directories and paths for this example. 
+        example_directory   = os.path.join("examples", directory)
+        examples_to_run_path = os.path.join(example_directory, "examples-to-run.py")
+        cpp_executable_dir   = os.path.join(NS3_BUILDDIR, NS3_ACTIVE_VARIANT, example_directory)
+        python_script_dir    = os.path.join(example_directory)
+
+        # Parse this example directory's file.
+        parse_examples_to_run_file(
+            examples_to_run_path,
+            cpp_executable_dir,
+            python_script_dir,
+            example_tests,
+            python_tests)
+
+    for module in NS3_ENABLED_MODULES:
+        # Remove the "ns3-" from the module name.
+        module = module[len("ns3-"):]
+
+        # XXX This code that adds extra subdirectories to some of the
+        # modules' paths should be removed from this file once these
+        # modules have been moved to the same level as all of the
+        # other modules.
+        #
+        # Some modules are one subdirectory lower in the directory
+        # structure than others.
+        #
+        # Add the extract subdirectory to this module's path if it
+        # needs it.
+        moduleOneSubdirLower = {
+            "flow-monitor": "contrib",
+            "bridge": "devices", 
+            "virtual-net-device": "devices",
+            "olsr": "routing"
+            }
+        if module in moduleOneSubdirLower:
+            module = os.path.join(moduleOneSubdirLower[module], module)
+
+        # Set the directories and paths for this example. 
+        module_directory     = os.path.join("modules", module)
+        example_directory    = os.path.join(module_directory, "examples")
+        examples_to_run_path = os.path.join(module_directory, "test", "examples-to-run.py")
+        cpp_executable_dir   = os.path.join(NS3_BUILDDIR, NS3_ACTIVE_VARIANT, example_directory)
+        python_script_dir    = os.path.join(example_directory)
+
+        # Parse this module's file.
+        parse_examples_to_run_file(
+            examples_to_run_path,
+            cpp_executable_dir,
+            python_script_dir,
+            example_tests,
+            python_tests)
+
     #
     # If lots of logging is enabled, we can crash Python when it tries to 
     # save all of the text.  We just don't allow logging to be turned on when