Skip to content
Snippets Groups Projects
Commit e5b78473 authored by Daniel Agar's avatar Daniel Agar
Browse files

delete unused cmake/test

parent 678e2c41
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
"""
The module facilitates testing in cmake.
It takes a command and a regex for failure ok passing.
It passes if:
* No stderr output.
* Stdout doesn't match failure regex.
* Stdout matches ok regex if given.
"""
from __future__ import print_function
import argparse
import subprocess
import re
import sys
#pylint: disable=invalid-name
parser = argparse.ArgumentParser()
parser.add_argument('cmd')
parser.add_argument('--re-fail')
parser.add_argument('--re-ok')
parser.add_argument('--verbose', '-v', dest='verbose', action='store_true')
parser.set_defaults(verbose=False)
args = parser.parse_args()
proc = subprocess.Popen(args.cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = proc.communicate()
if stderr != "":
print(stderr)
sys.exit(1)
if args.re_fail is not None:
fail_match = re.search(args.re_fail, stdout)
if fail_match is not None:
print(stdout)
sys.exit(1)
if args.re_ok is not None:
ok_match = re.search(args.re_ok, stdout)
if re.match(args.re_ok, stdout) is None:
print(stdout)
sys.exit(1)
if args.verbose:
print(stdout)
sys.exit(0)
# vim: set et ft=python fenc=utf-8 ff=unix sts=4 sw=4 ts=4 :
INFO Shell id is 47996278451456
WARN 1 starting task wkr_high (file /home/jgoppert/git/px4/cmake-Firmware/src/platforms/posix/px4_layer/px4_posix_tasks.cpp line 146)
WARN 54 starting task wkr_low (file /home/jgoppert/git/px4/cmake-Firmware/src/platforms/posix/px4_layer/px4_posix_tasks.cpp line 146)
WARN 100 starting task wkr_hrt (file /home/jgoppert/git/px4/cmake-Firmware/src/platforms/posix/px4_layer/px4_posix_tasks.cpp line 146)
App name: px4
Enter a command and its args:
----------------------------------
Running: uorb
Returning: uorb
Enter a command and its args:
----------------------------------
Running: accelsim
Returning: accelsim
Enter a command and its args:
----------------------------------
Running: px4_simple_app
Hello Sky!
[px4_simple_app] Got no data within a second
[px4_simple_app] Got no data within a second
[px4_simple_app] Got no data within a second
[px4_simple_app] Got no data within a second
[px4_simple_app] Got no data within a second
Returning: px4_simple_app
Enter a command and its args:
----------------------------------
Running: shutdown
Shutting down
uorb start
accelsim start
px4_simple_app
shutdown
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment