Skip to contentSkip to conversation

tc-testing: split config file

PATCH In review Brenda J. Butler 3 participants 4 messages Oct 31, 2017 – Nov 1, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tc-testing: split config file

Move the config customization into a site-local file tdc_config_local.py, so that updates of the tdc test software does not require hand-editing of the config. This patch includes a template for the site-local customization file.

In addition, this makes it easy to revert to a stock tdc environment for testing the test framework and/or the core tests.

Also it makes it harder for any custom config to be submitted back to the kernel tdc.

---
 tools/testing/selftests/tc-testing/tdc_config.py   | 14 +++++++++++++
 .../tc-testing/tdc_config_local_template.py        | 24 ++++++++++++++++++++++
 2 files changed, 38 insertions(+)
 create mode 100644 tools/testing/selftests/tc-testing/tdc_config_local_template.py
tools/testing/selftests/tc-testing/tdc_config.py +14 -0
index b6352515c1b5..596558445713 100644
@@ -17,3 +17,17 @@ NAMES = {
           # Name of the namespace to use
           'NS': 'tcut'
         }
+
+
+ENVIR = { }
+
+# put customizations in tdc_config_local.py
+try:
+    from tdc_config_local import *
+except ImportError as ie:
+    pass
+
+try:
+    NAMES.update(EXTRA_NAMES)
+except NameError as ne:
+    pass
tools/testing/selftests/tc-testing/tdc_config_local_template.py new file +24 -0
new file mode 100644
index 000000000000..24bad1633cac
@@ -0,0 +1,24 @@
+"""
+tdc_config_local.py - tdc plugin-writer-specified values
+
+Copyright (C) 2017 [email protected]
+"""
+
+import os
+
+ENVIR = os.environ.copy()
+
+ENV_LD_LIBRARY_PATH = os.getenv('LD_LIBRARY_PATH', '')
+ENV_OTHER_LIB = os.getenv('OTHER_LIB', '')
+
+
+# example adding value to NAMES, without editing tdc_config.py
+EXTRA_NAMES = dict()
+EXTRA_NAMES['SOME_BIN'] = os.path.join(os.getenv('OTHER_BIN', ''), 'some_bin')
+
+
+# example adding values to ENVIR, without editing tdc_config.py
+ENVIR['VALGRIND_LIB'] = '/usr/lib/valgrind'
+ENVIR['VALGRIND_BIN'] = '/usr/bin/valgrind'
+ENVIR['VGDB_BIN'] = '/usr/bin/vgdb'
+
Signature · 1 line
2.15.0.rc0
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Brenda J. Butler

Move the config customization into a site-local file tdc_config_local.py, so that updates of the tdc test software does not require hand-editing of the config. This patch includes a template for the site-local customization file.

Quoted 8 lines

In addition, this makes it easy to revert to a stock tdc environment for testing the test framework and/or the core tests.

Also it makes it harder for any custom config to be submitted back to the kernel tdc.

maintainer
#2 lore raw
In reply to Brenda J. Butler

From: "Brenda J. Butler" <[email protected]>
Date: Tue, 31 Oct 2017 14:27:28 -0400

Quoted 6 lines

Move the config customization into a site-local file tdc_config_local.py, so that updates of the tdc test software does not require hand-editing of the config. This patch includes a template for the site-local customization file.

Quoted 8 lines

In addition, this makes it easy to revert to a stock tdc environment for testing the test framework and/or the core tests.

Also it makes it harder for any custom config to be submitted back to the kernel tdc.

Please always remove trailing empty lines in files, GIT even warns about this when one tries to apply the patch:

Quoted 5 lines
tools/testing/selftests/tc-testing/tdc_config.py +1 -0
@@ -17,3 +17,17 @@ NAMES = {
           # Name of the namespace to use
           'NS': 'tcut'
         }
+

...

tools/testing/selftests/tc-testing/tdc_config_local_template.py line 24

Quoted 5 lines
tools/testing/selftests/tc-testing/tdc_config_local_template.py new file +5 -0
+# example adding values to ENVIR, without editing tdc_config.py
+ENVIR['VALGRIND_LIB'] = '/usr/lib/valgrind'
+ENVIR['VALGRIND_BIN'] = '/usr/bin/valgrind'
+ENVIR['VGDB_BIN'] = '/usr/bin/vgdb'
+

I fixed it up this time, but please be mindful of this in the future.

Thanks.

#3 lore raw
Quoted 5 lines · David Miller

From: "Brenda J. Butler" <[email protected]>
Date: Tue, 31 Oct 2017 14:27:28 -0400

Quoted 2 lines

Move the config customization into a site-local file tdc_config_local.py, so that updates of the tdc test

...

Quoted 11 lines
Quoted 1 line

Please always remove trailing empty lines in files, GIT even warns about this when one tries to apply the patch:

Quoted 5 lines
tools/testing/selftests/tc-testing/tdc_config.py +1 -0
@@ -17,3 +17,17 @@ NAMES = {
           # Name of the namespace to use
           'NS': 'tcut'
         }
+

...

Quoted 5 lines

tools/testing/selftests/tc-testing/tdc_config_local_template.py line 24

Quoted 5 lines
tools/testing/selftests/tc-testing/tdc_config_local_template.py new file +5 -0
+# example adding values to ENVIR, without editing tdc_config.py
+ENVIR['VALGRIND_LIB'] = '/usr/lib/valgrind'
+ENVIR['VALGRIND_BIN'] = '/usr/bin/valgrind'
+ENVIR['VGDB_BIN'] = '/usr/bin/vgdb'
+

Thank you, I will make sure to that.

bjb