Holger Hans Peter Freyther | eb0acb6 | 2013-06-24 15:47:34 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | |
| 3 | # (C) 2013 by Katerina Barone-Adesi <kat.obsc@gmail.com> |
| 4 | # (C) 2013 by Holger Hans Peter Freyther |
| 5 | # This program is free software: you can redistribute it and/or modify |
| 6 | # it under the terms of the GNU General Public License as published by |
| 7 | # the Free Software Foundation, either version 3 of the License, or |
| 8 | # (at your option) any later version. |
| 9 | |
| 10 | # This program is distributed in the hope that it will be useful, |
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | # GNU General Public License for more details. |
| 14 | |
| 15 | # You should have received a copy of the GNU General Public License |
| 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
Max | 3e67689 | 2016-11-16 14:55:21 +0100 | [diff] [blame] | 18 | import os, sys |
Holger Hans Peter Freyther | eb0acb6 | 2013-06-24 15:47:34 +0200 | [diff] [blame] | 19 | import time |
| 20 | import unittest |
Jacob Erlbeck | 6cb2ccc | 2013-08-14 11:10:34 +0200 | [diff] [blame] | 21 | import socket |
Neels Hofmeyr | bcfee2a | 2017-02-03 16:09:17 +0100 | [diff] [blame] | 22 | import subprocess |
Holger Hans Peter Freyther | eb0acb6 | 2013-06-24 15:47:34 +0200 | [diff] [blame] | 23 | |
| 24 | import osmopy.obscvty as obscvty |
| 25 | import osmopy.osmoutil as osmoutil |
| 26 | |
Neels Hofmeyr | 476c4bb | 2017-02-24 17:55:11 +0100 | [diff] [blame] | 27 | # add $top_srcdir/contrib to find ipa.py |
| 28 | sys.path.append(os.path.join(sys.path[0], '..', 'contrib')) |
| 29 | |
Max | 3e67689 | 2016-11-16 14:55:21 +0100 | [diff] [blame] | 30 | from ipa import IPA |
| 31 | |
Neels Hofmeyr | 476c4bb | 2017-02-24 17:55:11 +0100 | [diff] [blame] | 32 | # to be able to find $top_srcdir/doc/... |
| 33 | confpath = os.path.join(sys.path[0], '..') |
Holger Hans Peter Freyther | eb0acb6 | 2013-06-24 15:47:34 +0200 | [diff] [blame] | 34 | |
| 35 | class TestVTYBase(unittest.TestCase): |
| 36 | |
Neels Hofmeyr | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 37 | def checkForEndAndExit(self): |
| 38 | res = self.vty.command("list") |
| 39 | #print ('looking for "exit"\n') |
| 40 | self.assert_(res.find(' exit\r') > 0) |
| 41 | #print 'found "exit"\nlooking for "end"\n' |
| 42 | self.assert_(res.find(' end\r') > 0) |
| 43 | #print 'found "end"\n' |
| 44 | |
Holger Hans Peter Freyther | eb0acb6 | 2013-06-24 15:47:34 +0200 | [diff] [blame] | 45 | def vty_command(self): |
| 46 | raise Exception("Needs to be implemented by a subclass") |
| 47 | |
| 48 | def vty_app(self): |
| 49 | raise Exception("Needs to be implemented by a subclass") |
| 50 | |
| 51 | def setUp(self): |
| 52 | osmo_vty_cmd = self.vty_command()[:] |
| 53 | config_index = osmo_vty_cmd.index('-c') |
| 54 | if config_index: |
| 55 | cfi = config_index + 1 |
| 56 | osmo_vty_cmd[cfi] = os.path.join(confpath, osmo_vty_cmd[cfi]) |
| 57 | |
| 58 | try: |
Holger Hans Peter Freyther | eb0acb6 | 2013-06-24 15:47:34 +0200 | [diff] [blame] | 59 | self.proc = osmoutil.popen_devnull(osmo_vty_cmd) |
| 60 | except OSError: |
| 61 | print >> sys.stderr, "Current directory: %s" % os.getcwd() |
| 62 | print >> sys.stderr, "Consider setting -b" |
Holger Hans Peter Freyther | eb0acb6 | 2013-06-24 15:47:34 +0200 | [diff] [blame] | 63 | |
| 64 | appstring = self.vty_app()[2] |
| 65 | appport = self.vty_app()[0] |
| 66 | self.vty = obscvty.VTYInteract(appstring, "127.0.0.1", appport) |
| 67 | |
| 68 | def tearDown(self): |
Neels Hofmeyr | 40a91b3 | 2017-02-24 17:54:22 +0100 | [diff] [blame] | 69 | if self.vty: |
| 70 | self.vty._close_socket() |
Holger Hans Peter Freyther | eb0acb6 | 2013-06-24 15:47:34 +0200 | [diff] [blame] | 71 | self.vty = None |
| 72 | osmoutil.end_proc(self.proc) |
| 73 | |
Neels Hofmeyr | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 74 | class TestVTYMSC(TestVTYBase): |
Holger Hans Peter Freyther | c63f6f1 | 2013-07-27 21:07:57 +0200 | [diff] [blame] | 75 | |
| 76 | def vty_command(self): |
Neels Hofmeyr | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 77 | return ["./src/osmo-msc/osmo-msc", "-c", |
| 78 | "doc/examples/osmo-msc/osmo-msc.cfg"] |
Holger Hans Peter Freyther | c63f6f1 | 2013-07-27 21:07:57 +0200 | [diff] [blame] | 79 | |
| 80 | def vty_app(self): |
Neels Hofmeyr | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 81 | return (4254, "./src/osmo-msc/osmo-msc", "OsmoMSC", "msc") |
Holger Hans Peter Freyther | c63f6f1 | 2013-07-27 21:07:57 +0200 | [diff] [blame] | 82 | |
Neels Hofmeyr | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 83 | def testConfigNetworkTree(self, include_bsc_items=True): |
| 84 | self.vty.enable() |
| 85 | self.assertTrue(self.vty.verify("configure terminal",[''])) |
| 86 | self.assertEquals(self.vty.node(), 'config') |
| 87 | self.checkForEndAndExit() |
| 88 | self.assertTrue(self.vty.verify("network",[''])) |
| 89 | self.assertEquals(self.vty.node(), 'config-net') |
| 90 | self.checkForEndAndExit() |
| 91 | self.vty.command("write terminal") |
| 92 | self.assertTrue(self.vty.verify("exit",[''])) |
| 93 | self.assertEquals(self.vty.node(), 'config') |
| 94 | self.assertTrue(self.vty.verify("exit",[''])) |
| 95 | self.assertTrue(self.vty.node() is None) |
Jacob Erlbeck | 96903c4 | 2013-09-02 13:17:14 +0200 | [diff] [blame] | 96 | |
Holger Hans Peter Freyther | 0df1ab9 | 2013-09-02 20:58:38 +0200 | [diff] [blame] | 97 | def checkForSmpp(self): |
| 98 | """SMPP is not always enabled, check if it is""" |
| 99 | res = self.vty.command("list") |
| 100 | return "smpp" in res |
| 101 | |
Holger Hans Peter Freyther | 42cf2e0 | 2015-07-06 16:41:30 +0200 | [diff] [blame] | 102 | def testSmppFirst(self): |
Holger Hans Peter Freyther | 42cf2e0 | 2015-07-06 16:41:30 +0200 | [diff] [blame] | 103 | # enable the configuration |
| 104 | self.vty.enable() |
| 105 | self.vty.command("configure terminal") |
Holger Hans Peter Freyther | a2c41c4 | 2015-07-13 11:23:53 +0200 | [diff] [blame] | 106 | |
| 107 | if not self.checkForSmpp(): |
| 108 | return |
| 109 | |
Holger Hans Peter Freyther | 42cf2e0 | 2015-07-06 16:41:30 +0200 | [diff] [blame] | 110 | self.vty.command("smpp") |
| 111 | |
| 112 | # check the default |
| 113 | res = self.vty.command("write terminal") |
| 114 | self.assert_(res.find(' no smpp-first') > 0) |
| 115 | |
| 116 | self.vty.verify("smpp-first", ['']) |
| 117 | res = self.vty.command("write terminal") |
| 118 | self.assert_(res.find(' smpp-first') > 0) |
| 119 | self.assertEquals(res.find('no smpp-first'), -1) |
| 120 | |
| 121 | self.vty.verify("no smpp-first", ['']) |
| 122 | res = self.vty.command("write terminal") |
| 123 | self.assert_(res.find('no smpp-first') > 0) |
| 124 | |
Jacob Erlbeck | 96903c4 | 2013-09-02 13:17:14 +0200 | [diff] [blame] | 125 | def testVtyTree(self): |
| 126 | self.vty.enable() |
| 127 | self.assertTrue(self.vty.verify("configure terminal", [''])) |
| 128 | self.assertEquals(self.vty.node(), 'config') |
Jacob Erlbeck | 6e919db | 2013-10-29 09:30:31 +0100 | [diff] [blame] | 129 | self.checkForEndAndExit() |
Jacob Erlbeck | 96903c4 | 2013-09-02 13:17:14 +0200 | [diff] [blame] | 130 | self.assertTrue(self.vty.verify('mncc-int', [''])) |
| 131 | self.assertEquals(self.vty.node(), 'config-mncc-int') |
| 132 | self.checkForEndAndExit() |
| 133 | self.assertTrue(self.vty.verify('exit', [''])) |
Holger Hans Peter Freyther | 0df1ab9 | 2013-09-02 20:58:38 +0200 | [diff] [blame] | 134 | |
| 135 | if self.checkForSmpp(): |
| 136 | self.assertEquals(self.vty.node(), 'config') |
Jacob Erlbeck | 7587727 | 2013-10-23 11:24:14 +0200 | [diff] [blame] | 137 | self.assertTrue(self.vty.verify('smpp', [''])) |
| 138 | self.assertEquals(self.vty.node(), 'config-smpp') |
Jacob Erlbeck | 6e919db | 2013-10-29 09:30:31 +0100 | [diff] [blame] | 139 | self.checkForEndAndExit() |
Jacob Erlbeck | 7587727 | 2013-10-23 11:24:14 +0200 | [diff] [blame] | 140 | self.assertTrue(self.vty.verify("exit", [''])) |
Holger Hans Peter Freyther | 0df1ab9 | 2013-09-02 20:58:38 +0200 | [diff] [blame] | 141 | |
Jacob Erlbeck | 0ae92a9 | 2013-09-02 13:17:16 +0200 | [diff] [blame] | 142 | self.assertEquals(self.vty.node(), 'config') |
Jacob Erlbeck | 96903c4 | 2013-09-02 13:17:14 +0200 | [diff] [blame] | 143 | self.assertTrue(self.vty.verify("exit", [''])) |
| 144 | self.assertTrue(self.vty.node() is None) |
| 145 | |
| 146 | # Check searching for outer node's commands |
| 147 | self.vty.command("configure terminal") |
| 148 | self.vty.command('mncc-int') |
Holger Hans Peter Freyther | 0df1ab9 | 2013-09-02 20:58:38 +0200 | [diff] [blame] | 149 | |
| 150 | if self.checkForSmpp(): |
| 151 | self.vty.command('smpp') |
| 152 | self.assertEquals(self.vty.node(), 'config-smpp') |
| 153 | self.vty.command('mncc-int') |
| 154 | |
Jacob Erlbeck | 96903c4 | 2013-09-02 13:17:14 +0200 | [diff] [blame] | 155 | self.assertEquals(self.vty.node(), 'config-mncc-int') |
| 156 | |
Max | ddee01f | 2016-05-24 14:23:27 +0200 | [diff] [blame] | 157 | def testVtyAuthorization(self): |
| 158 | self.vty.enable() |
| 159 | self.vty.command("configure terminal") |
| 160 | self.vty.command("network") |
| 161 | self.assertTrue(self.vty.verify("auth policy closed", [''])) |
| 162 | self.assertTrue(self.vty.verify("auth policy regexp", [''])) |
| 163 | self.assertTrue(self.vty.verify("authorized-regexp ^001", [''])) |
| 164 | self.assertTrue(self.vty.verify("authorized-regexp 02$", [''])) |
| 165 | self.assertTrue(self.vty.verify("authorized-regexp *123.*", [''])) |
| 166 | self.vty.command("end") |
Max | ddee01f | 2016-05-24 14:23:27 +0200 | [diff] [blame] | 167 | |
Max | 0c1bc26 | 2016-04-20 12:06:06 +0200 | [diff] [blame] | 168 | def testSi2Q(self): |
| 169 | self.vty.enable() |
| 170 | self.vty.command("configure terminal") |
| 171 | self.vty.command("network") |
| 172 | self.vty.command("bts 0") |
| 173 | before = self.vty.command("show running-config") |
| 174 | self.vty.command("si2quater neighbor-list add earfcn 1911 threshold 11 2") |
| 175 | self.vty.command("si2quater neighbor-list add earfcn 1924 threshold 11 3") |
| 176 | self.vty.command("si2quater neighbor-list add earfcn 2111 threshold 11") |
| 177 | self.vty.command("si2quater neighbor-list del earfcn 1911") |
| 178 | self.vty.command("si2quater neighbor-list del earfcn 1924") |
| 179 | self.vty.command("si2quater neighbor-list del earfcn 2111") |
| 180 | self.assertEquals(before, self.vty.command("show running-config")) |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 181 | self.vty.command("si2quater neighbor-list add uarfcn 1976 13 1") |
| 182 | self.vty.command("si2quater neighbor-list add uarfcn 1976 38 1") |
| 183 | self.vty.command("si2quater neighbor-list add uarfcn 1976 44 1") |
| 184 | self.vty.command("si2quater neighbor-list add uarfcn 1976 120 1") |
| 185 | self.vty.command("si2quater neighbor-list add uarfcn 1976 140 1") |
| 186 | self.vty.command("si2quater neighbor-list add uarfcn 1976 163 1") |
| 187 | self.vty.command("si2quater neighbor-list add uarfcn 1976 166 1") |
| 188 | self.vty.command("si2quater neighbor-list add uarfcn 1976 217 1") |
| 189 | self.vty.command("si2quater neighbor-list add uarfcn 1976 224 1") |
| 190 | self.vty.command("si2quater neighbor-list add uarfcn 1976 225 1") |
| 191 | self.vty.command("si2quater neighbor-list add uarfcn 1976 226 1") |
| 192 | self.vty.command("si2quater neighbor-list del uarfcn 1976 13") |
| 193 | self.vty.command("si2quater neighbor-list del uarfcn 1976 38") |
| 194 | self.vty.command("si2quater neighbor-list del uarfcn 1976 44") |
| 195 | self.vty.command("si2quater neighbor-list del uarfcn 1976 120") |
| 196 | self.vty.command("si2quater neighbor-list del uarfcn 1976 140") |
| 197 | self.vty.command("si2quater neighbor-list del uarfcn 1976 163") |
| 198 | self.vty.command("si2quater neighbor-list del uarfcn 1976 166") |
| 199 | self.vty.command("si2quater neighbor-list del uarfcn 1976 217") |
| 200 | self.vty.command("si2quater neighbor-list del uarfcn 1976 224") |
| 201 | self.vty.command("si2quater neighbor-list del uarfcn 1976 225") |
| 202 | self.vty.command("si2quater neighbor-list del uarfcn 1976 226") |
| 203 | self.assertEquals(before, self.vty.command("show running-config")) |
Max | 0c1bc26 | 2016-04-20 12:06:06 +0200 | [diff] [blame] | 204 | |
Holger Hans Peter Freyther | c63f6f1 | 2013-07-27 21:07:57 +0200 | [diff] [blame] | 205 | def testEnableDisablePeriodicLU(self): |
| 206 | self.vty.enable() |
| 207 | self.vty.command("configure terminal") |
| 208 | self.vty.command("network") |
| 209 | self.vty.command("bts 0") |
| 210 | |
| 211 | # Test invalid input |
| 212 | self.vty.verify("periodic location update 0", ['% Unknown command.']) |
| 213 | self.vty.verify("periodic location update 5", ['% Unknown command.']) |
| 214 | self.vty.verify("periodic location update 1531", ['% Unknown command.']) |
| 215 | |
| 216 | # Enable periodic lu.. |
| 217 | self.vty.verify("periodic location update 60", ['']) |
| 218 | res = self.vty.command("write terminal") |
Holger Hans Peter Freyther | c0438e3 | 2013-07-27 22:23:25 +0200 | [diff] [blame] | 219 | self.assert_(res.find('periodic location update 60') > 0) |
Holger Hans Peter Freyther | c63f6f1 | 2013-07-27 21:07:57 +0200 | [diff] [blame] | 220 | self.assertEquals(res.find('no periodic location update'), -1) |
| 221 | |
| 222 | # Now disable it.. |
| 223 | self.vty.verify("no periodic location update", ['']) |
| 224 | res = self.vty.command("write terminal") |
| 225 | self.assertEquals(res.find('periodic location update 60'), -1) |
Holger Hans Peter Freyther | c0438e3 | 2013-07-27 22:23:25 +0200 | [diff] [blame] | 226 | self.assert_(res.find('no periodic location update') > 0) |
Holger Hans Peter Freyther | eb0acb6 | 2013-06-24 15:47:34 +0200 | [diff] [blame] | 227 | |
Ciaby | ec6e4f8 | 2014-03-06 17:20:55 +0100 | [diff] [blame] | 228 | def testShowNetwork(self): |
| 229 | res = self.vty.command("show network") |
| 230 | self.assert_(res.startswith('BSC is on Country Code') >= 0) |
| 231 | |
Holger Hans Peter Freyther | 8657326 | 2015-01-31 09:47:37 +0100 | [diff] [blame] | 232 | def testMeasurementFeed(self): |
| 233 | self.vty.enable() |
| 234 | self.vty.command("configure terminal") |
| 235 | self.vty.command("mncc-int") |
| 236 | |
| 237 | res = self.vty.command("write terminal") |
| 238 | self.assertEquals(res.find('meas-feed scenario'), -1) |
| 239 | |
| 240 | self.vty.command("meas-feed scenario bla") |
| 241 | res = self.vty.command("write terminal") |
| 242 | self.assert_(res.find('meas-feed scenario bla') > 0) |
| 243 | |
Neels Hofmeyr | 0867b72 | 2016-09-28 23:28:06 +0200 | [diff] [blame] | 244 | self.vty.command("meas-feed scenario abcdefghijklmnopqrstuvwxyz01234567890") |
Holger Hans Peter Freyther | 8657326 | 2015-01-31 09:47:37 +0100 | [diff] [blame] | 245 | res = self.vty.command("write terminal") |
| 246 | self.assertEquals(res.find('meas-feed scenario abcdefghijklmnopqrstuvwxyz01234567890'), -1) |
| 247 | self.assertEquals(res.find('meas-feed scenario abcdefghijklmnopqrstuvwxyz012345'), -1) |
| 248 | self.assert_(res.find('meas-feed scenario abcdefghijklmnopqrstuvwxyz01234') > 0) |
| 249 | |
Max | 4936448 | 2016-04-13 11:36:39 +0200 | [diff] [blame] | 250 | def ipa_handle_small(x, verbose = False): |
| 251 | s = data2str(x.recv(4)) |
Neels Hofmeyr | ba1468e | 2017-02-03 04:23:46 +0100 | [diff] [blame] | 252 | if len(s) != 4*2: |
| 253 | raise Exception("expected to receive 4 bytes, but got %d (%r)" % (len(s)/2, s)) |
Max | 4936448 | 2016-04-13 11:36:39 +0200 | [diff] [blame] | 254 | if "0001fe00" == s: |
| 255 | if (verbose): |
| 256 | print "\tBSC <- NAT: PING?" |
Max | 3e67689 | 2016-11-16 14:55:21 +0100 | [diff] [blame] | 257 | x.send(IPA().pong()) |
Max | 4936448 | 2016-04-13 11:36:39 +0200 | [diff] [blame] | 258 | elif "0001fe06" == s: |
| 259 | if (verbose): |
| 260 | print "\tBSC <- NAT: IPA ID ACK" |
Max | 3e67689 | 2016-11-16 14:55:21 +0100 | [diff] [blame] | 261 | x.send(IPA().id_ack()) |
Max | 4936448 | 2016-04-13 11:36:39 +0200 | [diff] [blame] | 262 | elif "0001fe00" == s: |
| 263 | if (verbose): |
| 264 | print "\tBSC <- NAT: PONG!" |
| 265 | else: |
| 266 | if (verbose): |
| 267 | print "\tBSC <- NAT: ", s |
| 268 | |
Neels Hofmeyr | bcfee2a | 2017-02-03 16:09:17 +0100 | [diff] [blame] | 269 | def ipa_handle_resp(x, tk, verbose = False, proc=None): |
Max | 4936448 | 2016-04-13 11:36:39 +0200 | [diff] [blame] | 270 | s = data2str(x.recv(38)) |
| 271 | if "0023fe040108010701020103010401050101010011" in s: |
Neels Hofmeyr | 7d17c3e | 2017-01-26 23:04:28 +0100 | [diff] [blame] | 272 | retries = 3 |
| 273 | while True: |
| 274 | print "\tsending IPA identity(%s) at %s" % (tk, time.strftime("%T")) |
| 275 | try: |
| 276 | x.send(IPA().id_resp(IPA().identity(name = tk.encode('utf-8')))) |
| 277 | print "\tdone sending IPA identity(%s) at %s" % (tk, |
| 278 | time.strftime("%T")) |
| 279 | break |
| 280 | except: |
| 281 | print "\tfailed sending IPA identity at", time.strftime("%T") |
Neels Hofmeyr | bcfee2a | 2017-02-03 16:09:17 +0100 | [diff] [blame] | 282 | if proc: |
| 283 | print "\tproc.poll() = %r" % proc.poll() |
Neels Hofmeyr | 7d17c3e | 2017-01-26 23:04:28 +0100 | [diff] [blame] | 284 | if retries < 1: |
| 285 | print "\tgiving up" |
| 286 | raise |
Neels Hofmeyr | e02e1e7 | 2017-02-03 05:55:26 +0100 | [diff] [blame] | 287 | print "\tretrying (%d attempts left)" % retries |
Neels Hofmeyr | 7d17c3e | 2017-01-26 23:04:28 +0100 | [diff] [blame] | 288 | retries -= 1 |
Max | 4936448 | 2016-04-13 11:36:39 +0200 | [diff] [blame] | 289 | else: |
| 290 | if (verbose): |
| 291 | print "\tBSC <- NAT: ", s |
| 292 | |
Holger Hans Peter Freyther | eb0acb6 | 2013-06-24 15:47:34 +0200 | [diff] [blame] | 293 | if __name__ == '__main__': |
| 294 | import argparse |
| 295 | import sys |
| 296 | |
| 297 | workdir = '.' |
| 298 | |
| 299 | parser = argparse.ArgumentParser() |
| 300 | parser.add_argument("-v", "--verbose", dest="verbose", |
| 301 | action="store_true", help="verbose mode") |
| 302 | parser.add_argument("-p", "--pythonconfpath", dest="p", |
| 303 | help="searchpath for config") |
| 304 | parser.add_argument("-w", "--workdir", dest="w", |
| 305 | help="Working directory") |
Neels Hofmeyr | 3f8a8f7 | 2017-02-28 02:43:29 +0100 | [diff] [blame] | 306 | parser.add_argument("test_name", nargs="*", help="(parts of) test names to run, case-insensitive") |
Holger Hans Peter Freyther | eb0acb6 | 2013-06-24 15:47:34 +0200 | [diff] [blame] | 307 | args = parser.parse_args() |
| 308 | |
| 309 | verbose_level = 1 |
| 310 | if args.verbose: |
| 311 | verbose_level = 2 |
| 312 | |
| 313 | if args.w: |
| 314 | workdir = args.w |
| 315 | |
| 316 | if args.p: |
| 317 | confpath = args.p |
| 318 | |
| 319 | print "confpath %s, workdir %s" % (confpath, workdir) |
| 320 | os.chdir(workdir) |
| 321 | print "Running tests for specific VTY commands" |
| 322 | suite = unittest.TestSuite() |
Neels Hofmeyr | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 323 | suite.addTest(unittest.TestLoader().loadTestsFromTestCase(TestVTYMSC)) |
Neels Hofmeyr | 3f8a8f7 | 2017-02-28 02:43:29 +0100 | [diff] [blame] | 324 | |
| 325 | if args.test_name: |
| 326 | osmoutil.pick_tests(suite, *args.test_name) |
| 327 | |
Neels Hofmeyr | 0a45c1e | 2016-09-28 23:48:02 +0200 | [diff] [blame] | 328 | res = unittest.TextTestRunner(verbosity=verbose_level, stream=sys.stdout).run(suite) |
Holger Hans Peter Freyther | eb0acb6 | 2013-06-24 15:47:34 +0200 | [diff] [blame] | 329 | sys.exit(len(res.errors) + len(res.failures)) |
Neels Hofmeyr | 23d37c9 | 2016-09-26 03:18:32 +0200 | [diff] [blame] | 330 | |
Neels Hofmeyr | 0867b72 | 2016-09-28 23:28:06 +0200 | [diff] [blame] | 331 | # vim: shiftwidth=4 expandtab nocin ai |