Change in osmo-gsm-tester[master]: Deprecate envvar OSMO_GSM_TESTER_CONF and remove other ones

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Thu May 7 16:40:42 UTC 2020


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18103 )


Change subject: Deprecate envvar OSMO_GSM_TESTER_CONF and remove other ones
......................................................................

Deprecate envvar OSMO_GSM_TESTER_CONF and remove other ones

Environment variable OSMO_GSM_TESTER_CONF is marked as deprecated and an
error is logged each time it's used. Same feature is available through
"-c" command line parameters, so having the envvar only makes things
more complex for no good reason. It cannot yet be completely dropped
since some environemnt still make use of it. Give some time to users to
adapt their setups.
Other environment variables setting some config apths can be dropped
since they are not being really used in any setup.

Change-Id: I7eb69f870d0dcb5906d45ae067d6bed1aabf5862
---
M contrib/jenkins-run.sh
A doc/examples/2g_osmocom/README.md
D doc/examples/2g_osmocom/README.txt
A doc/examples/4g_srsLTE/README.md
D doc/examples/4g_srsLTE/README.txt
M doc/manuals/chapters/config.adoc
M selftest/resource_test/resource_test.py
M selftest/suite_test/suite_test.py
M src/osmo-gsm-tester.py
M src/osmo_gsm_tester/core/config.py
A sysmocom/README.md
D sysmocom/README.txt
12 files changed, 76 insertions(+), 108 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/03/18103/1

diff --git a/contrib/jenkins-run.sh b/contrib/jenkins-run.sh
index 4a76c09..3962766 100755
--- a/contrib/jenkins-run.sh
+++ b/contrib/jenkins-run.sh
@@ -21,7 +21,7 @@
 # jenkins build job.
 # On failure, first clean up below and then return the exit code.
 exit_code="1"
-if python3 -u "$(which osmo-gsm-tester.py)" "$trial_dir" $OSMO_GSM_TESTER_OPTS ; then
+if python3 -u "$(which osmo-gsm-tester.py)" -c "$base/../sysmocom " "$trial_dir" $OSMO_GSM_TESTER_OPTS ; then
   exit_code="0"
 fi
 
diff --git a/doc/examples/2g_osmocom/README.md b/doc/examples/2g_osmocom/README.md
new file mode 100644
index 0000000..47b0737
--- /dev/null
+++ b/doc/examples/2g_osmocom/README.md
@@ -0,0 +1,22 @@
+This a sample 2G test suite configured and ready to use.
+The only thing missing is a trial dir containing binaries.
+
+You can point osmo-gsm-tester.py at this config using the '-c $DIR' command line
+argument, where DIR is the directory path where this README file resides.
+
+If you have your trial with binary tar archives in ~/my_trial
+you can run the suite for example like this:
+```
+osmo-gsm-tester.py -c $DIR ~/my_trial
+```
+
+Alternatively you can setup this example as default config for your user by
+doing something like:
+```
+mkdir -p ~/.config
+ln -s "$DIR" ~/.config/osmo-gsm-tester
+```
+
+A ./state dir will be created to store the current osmo-gsm-tester state. If
+you prefer not to write to $DIR, set up an own configuration pointing at a
+different path (see paths.conf: 'state_dir').
diff --git a/doc/examples/2g_osmocom/README.txt b/doc/examples/2g_osmocom/README.txt
deleted file mode 100644
index 4c869ca..0000000
--- a/doc/examples/2g_osmocom/README.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-This a sample gsm test suite configured and ready to use.
-The only thing missing is a trial dir containing binaries.
-
-You can point osmo-gsm-tester.py at this config using the OSMO_GSM_TESTER_CONF
-environment variable:
-
-    export OSMO_GSM_TESTER_CONF="$PWD"
-
-When there is no OSMO_GSM_TESTER_CONF set, osmo-gsm-tester will instead look
-for conf files in several locations like ~/.config/osmo-gsm-tester,
-/usr/local/etc/osmo-gsm-tester, /etc/osmo-gsm-tester.
-
-If you have your trial with binary tar archives in ~/my_trial
-you can run the suite for example like this:
-
-    osmo-gsm-tester.py ~/my_trial
-
-Specifically, from this dir:
-
-    OSMO_GSM_TESTER_CONF="$PWD" ../src/osmo-gsm-tester.py ~/my_trial
-
-Alternatively you can setup this example as permanent config using something
-like:
-
-    mkdir -p ~/.config
-    ln -s "$PWD" ~/.config/osmo-gsm-tester
-
-A ./state dir will be created to store the current osmo-gsm-tester state. If
-you prefer not to write to $PWD, set up an own configuration pointing at a
-different path (see paths.conf: 'state_dir').
diff --git a/doc/examples/4g_srsLTE/README.md b/doc/examples/4g_srsLTE/README.md
new file mode 100644
index 0000000..b577035
--- /dev/null
+++ b/doc/examples/4g_srsLTE/README.md
@@ -0,0 +1,22 @@
+This a sample 4G test suite configured and ready to use srsLTE stack.
+The only thing missing is a trial dir containing binaries.
+
+You can point osmo-gsm-tester.py at this config using the '-c $DIR' command line
+argument, where DIR is the directory path where this README file resides.
+
+If you have your trial with binary tar archives in ~/my_trial
+you can run the suite for example like this:
+```
+osmo-gsm-tester.py -c $DIR ~/my_trial
+```
+
+Alternatively you can setup this example as default config for your user by
+doing something like:
+```
+mkdir -p ~/.config
+ln -s "$DIR" ~/.config/osmo-gsm-tester
+```
+
+A ./state dir will be created to store the current osmo-gsm-tester state. If
+you prefer not to write to $DIR, set up an own configuration pointing at a
+different path (see paths.conf: 'state_dir').
diff --git a/doc/examples/4g_srsLTE/README.txt b/doc/examples/4g_srsLTE/README.txt
deleted file mode 100644
index 6840801..0000000
--- a/doc/examples/4g_srsLTE/README.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-This a sample 4G test suite configured and ready to use srsLTE stack.
-The only thing missing is a trial dir containing binaries.
-
-You can point osmo-gsm-tester.py at this config using the OSMO_GSM_TESTER_CONF
-environment variable:
-
-    export OSMO_GSM_TESTER_CONF="$PWD"
-
-When there is no OSMO_GSM_TESTER_CONF set, osmo-gsm-tester will instead look
-for conf files in several locations like ~/.config/osmo-gsm-tester,
-/usr/local/etc/osmo-gsm-tester, /etc/osmo-gsm-tester.
-
-If you have your trial with binary tar archives in ~/my_trial
-you can run the suite for example like this:
-
-    osmo-gsm-tester.py ~/my_trial
-
-Specifically, from this dir:
-
-    OSMO_GSM_TESTER_CONF="$PWD" ../../src/osmo-gsm-tester.py ~/my_trial
-
-Alternatively you can setup this example as permanent config using something
-like:
-
-    mkdir -p ~/.config
-    ln -s "$PWD" ~/.config/osmo-gsm-tester
-
-A ./state dir will be created to store the current osmo-gsm-tester state. If
-you prefer not to write to $PWD, set up an own configuration pointing at a
-different path (see paths.conf: 'state_dir').
diff --git a/doc/manuals/chapters/config.adoc b/doc/manuals/chapters/config.adoc
index 483fd8c..3f4bde1 100644
--- a/doc/manuals/chapters/config.adoc
+++ b/doc/manuals/chapters/config.adoc
@@ -185,12 +185,13 @@
 The osmo-gsm-tester looks for configuration files in various standard
 directories in this order:
 
+- '.' (Current Working Directory)
 - '$HOME/.config/osmo-gsm-tester/'
 - '/usr/local/etc/osmo-gsm-tester/'
 - '/etc/osmo-gsm-tester/'
 
-The config location can also be set by an environment variable
-'$OSMO_GSM_TESTER_CONF', which then overrides the above locations.
+The config location can also be set through '-c' command line argument, which
+then overrides the above locations.
 
 The osmo-gsm-tester expects to find the following configuration files in a
 configuration directory:
diff --git a/selftest/resource_test/resource_test.py b/selftest/resource_test/resource_test.py
index 39a7eb6..b74ba2a 100755
--- a/selftest/resource_test/resource_test.py
+++ b/selftest/resource_test/resource_test.py
@@ -13,7 +13,7 @@
 workdir = util.get_tempdir()
 
 # override config locations to make sure we use only the test conf
-config.ENV_CONF = os.path.join(os.path.dirname(sys.argv[0]), 'conf')
+config.override_conf = os.path.join(os.path.dirname(sys.argv[0]), 'conf')
 
 log.get_process_id = lambda: '123-1490837279'
 
diff --git a/selftest/suite_test/suite_test.py b/selftest/suite_test/suite_test.py
index 99671c6..fc5f9df 100755
--- a/selftest/suite_test/suite_test.py
+++ b/selftest/suite_test/suite_test.py
@@ -7,7 +7,7 @@
 from osmo_gsm_tester.core import suite
 from osmo_gsm_tester.core.schema import generate_schemas, get_all_schema
 
-config.ENV_CONF = os.path.join(os.path.dirname(sys.argv[0]))
+config.override_conf = os.path.join(os.path.dirname(sys.argv[0]))
 
 example_trial_dir = os.path.join('test_trial_tmp')
 
diff --git a/src/osmo-gsm-tester.py b/src/osmo-gsm-tester.py
index 7bd2fd6..1641fcb 100755
--- a/src/osmo-gsm-tester.py
+++ b/src/osmo-gsm-tester.py
@@ -124,8 +124,7 @@
     parser.add_argument('-R', '--source', dest='source', action='store_true',
             help='Enable stdout logging of source file')
     parser.add_argument('-c', '--conf-dir', dest='conf_dir',
-            help='''Specify configuration dir (overrides
-OSMO_GSM_TESTER_CONF env and default locations)''')
+            help='''Specify configuration directory path (containing paths.conf)''')
     args = parser.parse_args()
 
     if args.version:
diff --git a/src/osmo_gsm_tester/core/config.py b/src/osmo_gsm_tester/core/config.py
index 6730807..98d422f 100644
--- a/src/osmo_gsm_tester/core/config.py
+++ b/src/osmo_gsm_tester/core/config.py
@@ -58,9 +58,6 @@
 from . import schema
 from .util import is_dict, is_list, Dir, get_tempdir
 
-ENV_PREFIX = 'OSMO_GSM_TESTER_'
-ENV_CONF = os.getenv(ENV_PREFIX + 'CONF')
-
 override_conf = None
 
 DEFAULT_CONFIG_LOCATIONS = [
@@ -91,7 +88,9 @@
 def _get_config_file(basename, fail_if_missing=True):
     if override_conf:
         locations = [ override_conf ]
-    elif ENV_CONF:
+    elif os.getenv('OSMO_GSM_TESTER_CONF'):
+        ENV_CONF = os.getenv('OSMO_GSM_TESTER_CONF')
+        log.err('Using environment variable OSMO_GSM_TESTER_CONF=%s is deprecated. Rather use -c command line argument!' % ENV_CONF)
         locations = [ ENV_CONF ]
     else:
         locations = DEFAULT_CONFIG_LOCATIONS
@@ -123,13 +122,6 @@
 def get_configured_path(label, allow_unset=False):
     global PATHS
 
-    env_name = ENV_PREFIX + label.upper()
-    env_path = os.getenv(env_name)
-    if env_path:
-        real_env_path = os.path.realpath(env_path)
-        log.dbg('Found path', label, 'as', env_path, 'in', '$' + env_name, 'which is', real_env_path, _category=log.C_CNF)
-        return real_env_path
-
     if PATHS is None:
         paths_file, found_in = _get_config_file(PATHS_CONF)
         PATHS = read(paths_file, PATHS_SCHEMA)
diff --git a/sysmocom/README.md b/sysmocom/README.md
new file mode 100644
index 0000000..1b311a0
--- /dev/null
+++ b/sysmocom/README.md
@@ -0,0 +1,22 @@
+This a real 2G test suite configured and ready to use.
+The only thing missing is a trial dir containing binaries.
+
+You can point osmo-gsm-tester.py at this config using the '-c $DIR' command line
+argument, where DIR is the directory path where this README file resides.
+
+If you have your trial with binary tar archives in ~/my_trial
+you can run the suite for example like this:
+```
+osmo-gsm-tester.py -c $DIR ~/my_trial
+```
+
+Alternatively you can setup this example as default config for your user by
+doing something like:
+```
+mkdir -p ~/.config
+ln -s "$DIR" ~/.config/osmo-gsm-tester
+```
+
+A ./state dir will be created to store the current osmo-gsm-tester state. If
+you prefer not to write to $DIR, set up an own configuration pointing at a
+different path (see paths.conf: 'state_dir').
diff --git a/sysmocom/README.txt b/sysmocom/README.txt
deleted file mode 100644
index 76567f2..0000000
--- a/sysmocom/README.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-This a real gsm test suite configured and ready to use.
-The only thing missing is a trial dir containing binaries.
-
-You can point osmo-gsm-tester.py at this config using the OSMO_GSM_TESTER_CONF
-environment variable:
-
-    export OSMO_GSM_TESTER_CONF="$PWD"
-
-When there is no OSMO_GSM_TESTER_CONF set, osmo-gsm-tester will instead look
-for conf files in several locations like ~/.config/osmo-gsm-tester,
-/usr/local/etc/osmo-gsm-tester, /etc/osmo-gsm-tester.
-
-If you have your trial with binary tar archives in ~/my_trial
-you can run the suite for example like this:
-
-    osmo-gsm-tester.py ~/my_trial
-
-Specifically, from this dir:
-
-    OSMO_GSM_TESTER_CONF="$PWD" ../src/osmo-gsm-tester.py ~/my_trial
-
-Alternatively you can setup this example as permanent config using something
-like:
-
-    mkdir -p ~/.config
-    ln -s "$PWD" ~/.config/osmo-gsm-tester
-
-A ./state dir will be created to store the current osmo-gsm-tester state. If
-you prefer not to write to $PWD, set up an own configuration pointing at a
-different path (see paths.conf: 'state_dir').

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18103
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Change-Id: I7eb69f870d0dcb5906d45ae067d6bed1aabf5862
Gerrit-Change-Number: 18103
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200507/6630a76e/attachment.htm>


More information about the gerrit-log mailing list