4 Test: grep input bags to bag output.
6 ------------------------------------------------------------------------------
7 This file is part of grepros - grep for ROS bag files and live topics.
8 Released under the BSD License.
13 ------------------------------------------------------------------------------
19 sys.path.insert(0, os.path.join(os.path.dirname(__file__),
".."))
20 from test
import testbase
22 logger = logging.getLogger()
26 """Tests grepping from input bags and writing matches to bag."""
29 NAME = os.path.splitext(os.path.basename(__file__))[0]
32 OUTPUT_LABEL =
"ROS bag"
35 OUTPUT_SUFFIX = testbase.TestBase.BAG_SUFFIX
38 """Collects bags in data directory, assembles command."""
43 """Runs grepros on bags in data directory, verifies bag output."""
46 self.assertTrue(os.path.isfile(self.
_outname),
"Expected output file not written.")
48 logger.info(
"Reading data from written %s.", self.
OUTPUT_LABEL)
51 for topic, msg, _
in outfile.read_messages():
52 messages.setdefault(topic, []).append(msg)
55 fulltext =
"\n".join(str(m)
for mm
in messages.values()
for m
in mm)
59 if "__main__" == __name__:
60 TestBagInputBagOutput.run_rostest()