Neels Hofmeyr | 726b58d | 2017-10-15 03:01:09 +0200 | [diff] [blame] | 1 | #!/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 | ''' |
| 22 | Run CTRL test transcripts against a given application. |
| 23 | |
| 24 | A CTRL transcript contains CTRL commands and their expected results. |
| 25 | It looks like: |
| 26 | |
| 27 | " |
| 28 | SET 1 var val |
| 29 | SET_REPLY 1 var OK |
| 30 | GET 2 var |
| 31 | GET_REPLY 2 var val |
| 32 | " |
| 33 | |
| 34 | The 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 | |
| 39 | This module can either be run directly to run or update a given CTRL transcript, |
| 40 | or it can be imported as a module to run more complex setups. |
| 41 | ''' |
| 42 | |
Neels Hofmeyr | 6562c08 | 2017-10-18 03:20:04 +0200 | [diff] [blame] | 43 | from osmopy.osmo_interact_ctrl import * |
Neels Hofmeyr | 726b58d | 2017-10-15 03:01:09 +0200 | [diff] [blame] | 44 | |
| 45 | if __name__ == '__main__': |
| 46 | parser = common_parser() |
Neels Hofmeyr | 6562c08 | 2017-10-18 03:20:04 +0200 | [diff] [blame] | 47 | parser_add_verify_args(parser) |
Neels Hofmeyr | 726b58d | 2017-10-15 03:01:09 +0200 | [diff] [blame] | 48 | 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 Hofmeyr | 6562c08 | 2017-10-18 03:20:04 +0200 | [diff] [blame] | 56 | main_verify_transcripts(args.run_app_str, args.transcript_files, interact, args.verbose) |
Neels Hofmeyr | 726b58d | 2017-10-15 03:01:09 +0200 | [diff] [blame] | 57 | |
| 58 | # vim: tabstop=4 shiftwidth=4 expandtab nocin ai |