Пример #1
0
def parse_arguments():
    desc = "Run program with libtthread."
    parser = argparse.ArgumentParser(description=desc)
    h1 = "path to libtthread.so " "(default: ../../libtthread.so - relative to script path)"
    parser.add_argument("--libtthread-path", nargs="?", default=tthread.default_library_path(), help=h1)
    h2 = (
        "path to trace file (default: stdout); "
        "if no trace file is specified, "
        "stdout of programm is redirected to stderr"
    )
    parser.add_argument("--output", nargs="?", help=h2)
    h3 = "default format to write access log " "(supported: %s; default: tsv)" % supported_formats
    parser.add_argument("--format", nargs="?", default="tsv", help=h3)
    parser.add_argument("command", nargs=1, help="command to execute with")
    parser.add_argument("arguments", nargs="*", default=[], help="arguments passed to command")
    return parser.parse_args()
Пример #2
0
 def test_accesslog(self):
     test_binary = os.path.join(TEST_ROOT, "../../test/usage-test")
     if not os.path.isfile(test_binary):
         msg = "test binary '%s' does not exists, please run 'make' first" \
                 % test_binary
         self.fail(msg)
     path = tthread.default_library_path()
     if not os.path.isfile(path):
         self.fail("'%s' does not exists, please run 'make' first" % path)
     process = tthread.run(test_binary, path)
     log = process.wait()
     self.assertEqual(log.return_code, 0)
     events = list(log.read())
     self.assertEqual(len(events), 8)
     ev = events[0]
     self.assertIsInstance(ev, tthread.accesslog.WriteEvent)
     self.assertGreater(ev.return_address, 0)
     self.assertGreater(ev.address, 0)
     self.assertGreater(ev.thread_id, 0)
     log.close()
Пример #3
0
 def test_accesslog(self):
     test_binary = os.path.join(TEST_ROOT, "../../test/usage-test")
     if not os.path.isfile(test_binary):
         msg = "test binary '%s' does not exists, please run 'make' first" \
                 % test_binary
         self.fail(msg)
     path = tthread.default_library_path()
     if not os.path.isfile(path):
         self.fail("'%s' does not exists, please run 'make' first" % path)
     process = tthread.run(test_binary, path)
     log = process.wait()
     self.assertEqual(log.return_code, 0)
     events = list(log.read())
     self.assertEqual(len(events), 8)
     ev = events[0]
     self.assertIsInstance(ev, tthread.accesslog.WriteEvent)
     self.assertGreater(ev.return_address, 0)
     self.assertGreater(ev.address, 0)
     self.assertGreater(ev.thread_id, 0)
     log.close()
Пример #4
0
def parse_arguments():
    desc = "Run program with libtthread."
    parser = argparse.ArgumentParser(description=desc)
    h1 = "path to libtthread.so " \
         "(default: ../../libtthread.so - relative to script path)"
    parser.add_argument("--libtthread-path",
                        nargs="?",
                        default=tthread.default_library_path(),
                        help=h1)
    h2 = "path to trace file (default: stdout); " \
         "if no trace file is specified, " \
         "stdout of programm is redirected to stderr"
    parser.add_argument("--output", nargs="?", help=h2)
    h3 = "default format to write access log " \
         "(supported: %s; default: tsv)" % supported_formats
    parser.add_argument("--format", nargs="?", default="tsv", help=h3)
    parser.add_argument("command", nargs=1, help="command to execute with")
    parser.add_argument("arguments",
                        nargs="*",
                        default=[],
                        help="arguments passed to command")
    return parser.parse_args()