<p>Pau Espin Pedrol <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/13868">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">tests: Fix selection of python version<br><br>According to documentation (and personal experience), AM_PATH_PYTHON<br>selects the highest version of python, no matter if major version is<br>different, which means if both python2 and 3 are available, 3 will be<br>chosen an PYTHON will point to "/.../python" which is python3. Apparently,<br>the macro cannot be easily used to pick highest python2 version.<br><br>chosen an PYTHON will point to "/.../python" which is python3. Apparently,<br>the macro cannot be easily used to pick highest python2 version.<br><br>As {vty,ctrl}_test_runner.py require python2 and are incompatible with<br>python3, let's instead rely on the system having a "python2" binary<br>available, which is the case in most distros.<br><br>cherry-picked from: osmo-bsc.git 7e78681f0f740bd68ed5255b506a1efa08a231b1.<br><br>Change-Id: Icc147c8457116ad551d166313f3a79e1c2107a22<br>---<br>M openbsc/configure.ac<br>M openbsc/tests/Makefile.am<br>M openbsc/tests/ctrl_test_runner.py<br>M openbsc/tests/smpp_test_runner.py<br>M openbsc/tests/vty_test_runner.py<br>5 files changed, 12 insertions(+), 9 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/openbsc/configure.ac b/openbsc/configure.ac</span><br><span>index 704c7d7..5602313 100644</span><br><span>--- a/openbsc/configure.ac</span><br><span>+++ b/openbsc/configure.ac</span><br><span>@@ -198,7 +198,10 @@</span><br><span>                              [Include the VTY/CTRL tests in make check [default=no]]),</span><br><span>            [enable_ext_tests="$enableval"],[enable_ext_tests="no"])</span><br><span> if test "x$enable_ext_tests" = "xyes" ; then</span><br><span style="color: hsl(0, 100%, 40%);">-        AM_PATH_PYTHON</span><br><span style="color: hsl(120, 100%, 40%);">+        AC_CHECK_PROG(PYTHON2_AVAIL,python2,yes)</span><br><span style="color: hsl(120, 100%, 40%);">+      if test "x$PYTHON2_AVAIL" != "xyes" ; then</span><br><span style="color: hsl(120, 100%, 40%);">+                AC_MSG_ERROR([Please install python2 to run the VTY/CTRL tests.])</span><br><span style="color: hsl(120, 100%, 40%);">+     fi</span><br><span>   AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)</span><br><span>   if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then</span><br><span>          AC_MSG_ERROR([Please install git://osmocom.org/python/osmo-python-tests to run the VTY/CTRL tests.])</span><br><span>diff --git a/openbsc/tests/Makefile.am b/openbsc/tests/Makefile.am</span><br><span>index 7208a2f..a62451e 100644</span><br><span>--- a/openbsc/tests/Makefile.am</span><br><span>+++ b/openbsc/tests/Makefile.am</span><br><span>@@ -64,10 +64,10 @@</span><br><span> python-tests: $(BUILT_SOURCES)</span><br><span>        osmotestvty.py -p $(abs_top_srcdir) -w $(abs_top_builddir) -v</span><br><span>        osmotestconfig.py -p $(abs_top_srcdir) -w $(abs_top_builddir) -v</span><br><span style="color: hsl(0, 100%, 40%);">-        $(PYTHON) $(srcdir)/vty_test_runner.py -w $(abs_top_builddir) -v</span><br><span style="color: hsl(0, 100%, 40%);">-        $(PYTHON) $(srcdir)/ctrl_test_runner.py -w $(abs_top_builddir) -v</span><br><span style="color: hsl(120, 100%, 40%);">+     $(srcdir)/vty_test_runner.py -w $(abs_top_builddir) -v</span><br><span style="color: hsl(120, 100%, 40%);">+        $(srcdir)/ctrl_test_runner.py -w $(abs_top_builddir) -v</span><br><span> if BUILD_SMPP</span><br><span style="color: hsl(0, 100%, 40%);">-        $(PYTHON) $(srcdir)/smpp_test_runner.py -w $(abs_top_builddir) -v</span><br><span style="color: hsl(120, 100%, 40%);">+     $(srcdir)/smpp_test_runner.py -w $(abs_top_builddir) -v</span><br><span> endif</span><br><span>     rm -f $(top_builddir)/hlr.sqlite3</span><br><span> else</span><br><span>diff --git a/openbsc/tests/ctrl_test_runner.py b/openbsc/tests/ctrl_test_runner.py</span><br><span>old mode 100644</span><br><span>new mode 100755</span><br><span>index d76ed65..ad0a16b</span><br><span>--- a/openbsc/tests/ctrl_test_runner.py</span><br><span>+++ b/openbsc/tests/ctrl_test_runner.py</span><br><span>@@ -1,4 +1,4 @@</span><br><span style="color: hsl(0, 100%, 40%);">-#!/usr/bin/env python</span><br><span style="color: hsl(120, 100%, 40%);">+#!/usr/bin/env python2</span><br><span> </span><br><span> # (C) 2013 by Jacob Erlbeck <jerlbeck@sysmocom.de></span><br><span> # (C) 2014 by Holger Hans Peter Freyther</span><br><span>@@ -262,12 +262,12 @@</span><br><span>         self.assertEquals(r['mtype'], 'SET_REPLY')</span><br><span>         self.assertEquals(r['var'], 'bts.0.trx.0.max-power-reduction')</span><br><span>         self.assertEquals(r['value'], '22')</span><br><span style="color: hsl(0, 100%, 40%);">-        </span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>         r = self.do_get('bts.0.trx.0.max-power-reduction')</span><br><span>         self.assertEquals(r['mtype'], 'GET_REPLY')</span><br><span>         self.assertEquals(r['var'], 'bts.0.trx.0.max-power-reduction')</span><br><span>         self.assertEquals(r['value'], '22')</span><br><span style="color: hsl(0, 100%, 40%);">-        </span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>         r = self.do_set('bts.0.trx.0.max-power-reduction', '1')</span><br><span>         self.assertEquals(r['mtype'], 'ERROR')</span><br><span>         self.assertEquals(r['error'], 'Value must be even')</span><br><span>diff --git a/openbsc/tests/smpp_test_runner.py b/openbsc/tests/smpp_test_runner.py</span><br><span>old mode 100644</span><br><span>new mode 100755</span><br><span>index 58645aa..eccfa6b</span><br><span>--- a/openbsc/tests/smpp_test_runner.py</span><br><span>+++ b/openbsc/tests/smpp_test_runner.py</span><br><span>@@ -1,4 +1,4 @@</span><br><span style="color: hsl(0, 100%, 40%);">-#!/usr/bin/env python</span><br><span style="color: hsl(120, 100%, 40%);">+#!/usr/bin/env python2</span><br><span> </span><br><span> # (C) 2014 by Holger Hans Peter Freyther</span><br><span> # based on vty_test_runner.py:</span><br><span>diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py</span><br><span>old mode 100644</span><br><span>new mode 100755</span><br><span>index 44ccdd8..67adb71</span><br><span>--- a/openbsc/tests/vty_test_runner.py</span><br><span>+++ b/openbsc/tests/vty_test_runner.py</span><br><span>@@ -1,4 +1,4 @@</span><br><span style="color: hsl(0, 100%, 40%);">-#!/usr/bin/env python</span><br><span style="color: hsl(120, 100%, 40%);">+#!/usr/bin/env python2</span><br><span> </span><br><span> # (C) 2013 by Katerina Barone-Adesi <kat.obsc@gmail.com></span><br><span> # (C) 2013 by Holger Hans Peter Freyther</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/13868">change 13868</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/13868"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: openbsc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Icc147c8457116ad551d166313f3a79e1c2107a22 </div>
<div style="display:none"> Gerrit-Change-Number: 13868 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Pau Espin Pedrol <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>
<div style="display:none"> Gerrit-Reviewer: Pau Espin Pedrol <pespin@sysmocom.de> </div>