blob: 3afbc620c280f2a7712946fef698ea4d26a13557 [file] [log] [blame]
Neels Hofmeyr726b58d2017-10-15 03:01:09 +02001#!/usr/bin/env python3
2#
3# (C) 2017 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
4# All rights reserved.
5#
6# Author: Neels Hofmeyr <nhofmeyr@sysmocom.de>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
21'''
22Run CTRL test transcripts against a given application.
23
24A CTRL transcript contains CTRL commands and their expected results.
25It looks like:
26
27"
28SET 1 var val
29SET_REPLY 1 var OK
30GET 2 var
31GET_REPLY 2 var val
32"
33
34The application to be tested is described by
35- a binary to run,
36- command line arguments to pass to the binary,
37- the CTRL port.
38
39This module can either be run directly to run or update a given CTRL transcript,
40or it can be imported as a module to run more complex setups.
41'''
42
Neels Hofmeyr6562c082017-10-18 03:20:04 +020043from osmopy.osmo_interact_ctrl import *
Neels Hofmeyr726b58d2017-10-15 03:01:09 +020044
45if __name__ == '__main__':
46 parser = common_parser()
Neels Hofmeyr6562c082017-10-18 03:20:04 +020047 parser_add_verify_args(parser)
Neels Hofmeyr726b58d2017-10-15 03:01:09 +020048 parser.add_argument('-i', '--keep-ids', dest='keep_ids', action='store_true',
49 help='With --update, default is to overwrite the command IDs'
50 ' so that they are consecutive numbers starting from 1.'
51 ' With --keep-ids, do not change these command IDs.')
52 args = parser.parse_args()
53
54 interact = InteractCtrl(args.port, args.host, args.verbose, args.update, args.keep_ids)
55
Neels Hofmeyr6562c082017-10-18 03:20:04 +020056 main_verify_transcripts(args.run_app_str, args.transcript_files, interact, args.verbose)
Neels Hofmeyr726b58d2017-10-15 03:01:09 +020057
58# vim: tabstop=4 shiftwidth=4 expandtab nocin ai