From b46deb1417dc3596e9ac9fe2fe8cc0b7f42457e7 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Mon, 26 Oct 2015 06:29:00 +0000 Subject: "Any programmer who fails to comply with the standard naming, formatting, or commenting conventions should be shot. If it so happens that it is inconvenient to shoot him, then he is to be politely requested to recode his program in adherence to the above standard." -- Michael Spier, Digital Equipment Corporation svn path=/branches/tk705/; revision=6152 --- ca/tests/test-rrdp.py | 114 +++++++++++++++++++++++++------------------------- 1 file changed, 57 insertions(+), 57 deletions(-) (limited to 'ca/tests/test-rrdp.py') diff --git a/ca/tests/test-rrdp.py b/ca/tests/test-rrdp.py index 1a9db929..97797444 100755 --- a/ca/tests/test-rrdp.py +++ b/ca/tests/test-rrdp.py @@ -38,22 +38,22 @@ parser.add_argument("--dry-run", action = "store_true") args = parser.parse_args() def log(msg): - sys.stdout.write(msg + "\n") - sys.stdout.flush() + sys.stdout.write(msg + "\n") + sys.stdout.flush() def run(*argv): - log("Running: " + " ".join(argv)) - if not args.dry_run: - subprocess.check_call(argv) + log("Running: " + " ".join(argv)) + if not args.dry_run: + subprocess.check_call(argv) def dataglob(pattern): - return glob.iglob(os.path.join(("smoketest.dir" if args.use_smoketest else "yamltest.dir/RIR"), pattern)) + return glob.iglob(os.path.join(("smoketest.dir" if args.use_smoketest else "yamltest.dir/RIR"), pattern)) def snapshot_to_serial(fn): - return int(os.path.splitext(os.path.basename(fn))[0]) + return int(os.path.splitext(os.path.basename(fn))[0]) def delta_to_serial(fn): - return int(os.path.splitext(os.path.basename(fn))[0]) + return int(os.path.splitext(os.path.basename(fn))[0]) top = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "..", "..")) @@ -62,62 +62,62 @@ rcynic = os.path.join(top, "rp/rcynic/rcynic") rcynic_text = os.path.join(top, "rp/rcynic/rcynic-text") with open("rcynic-rrdp.conf", "w") as f: - f.write(textwrap.dedent('''# Automatically generated for RRDP tests, do not edit. - [rcynic] - xml-summary = rcynic.xml - jitter = 0 - use-links = yes - use-syslog = no - use-stderr = yes - log-level = log_debug - run-rsync = no - ''')) - if args.use_smoketest: - f.write("trust-anchor = smoketest.dir/root.cer\n") - else: - f.write("trust-anchor = yamltest.dir/RIR/publication/RIR-root/root.cer\n") + f.write(textwrap.dedent('''# Automatically generated for RRDP tests, do not edit. + [rcynic] + xml-summary = rcynic.xml + jitter = 0 + use-links = yes + use-syslog = no + use-stderr = yes + log-level = log_debug + run-rsync = no + ''')) + if args.use_smoketest: + f.write("trust-anchor = smoketest.dir/root.cer\n") + else: + f.write("trust-anchor = yamltest.dir/RIR/publication/RIR-root/root.cer\n") if args.skip_daemons: - log("--skip-daemons specified, so running neither smoketest nor yamltest") + log("--skip-daemons specified, so running neither smoketest nor yamltest") elif args.use_smoketest: - run("python", "smoketest.py", args.yaml_file) + run("python", "smoketest.py", args.yaml_file) else: - run("python", "sql-cleaner.py") - class GotSIGUSR1(Exception): - pass - def handle_sigusr1(signum, frame): - raise GotSIGUSR1 - old_sigusr1 = signal.signal(signal.SIGUSR1, handle_sigusr1) - cmd = ("python", "yamltest.py", args.yaml_file, "--notify-when-startup-complete", str(os.getpid())) - log("Running: " + " ".join(cmd)) - yamltest = subprocess.Popen(cmd) - log("Waiting for SIGUSR1 from yamltest") - try: - while True: - signal.pause() - except GotSIGUSR1: - signal.signal(signal.SIGUSR1, old_sigusr1) - log("Sleeping %s" % args.delay) - time.sleep(args.delay) - yamltest.terminate() + run("python", "sql-cleaner.py") + class GotSIGUSR1(Exception): + pass + def handle_sigusr1(signum, frame): + raise GotSIGUSR1 + old_sigusr1 = signal.signal(signal.SIGUSR1, handle_sigusr1) + cmd = ("python", "yamltest.py", args.yaml_file, "--notify-when-startup-complete", str(os.getpid())) + log("Running: " + " ".join(cmd)) + yamltest = subprocess.Popen(cmd) + log("Waiting for SIGUSR1 from yamltest") + try: + while True: + signal.pause() + except GotSIGUSR1: + signal.signal(signal.SIGUSR1, old_sigusr1) + log("Sleeping %s" % args.delay) + time.sleep(args.delay) + yamltest.terminate() snapshots = dict((snapshot_to_serial(fn), fn) for fn in dataglob("rrdp-publication/*/snapshot/*.xml")) deltas = dict((delta_to_serial(fn), fn) for fn in dataglob("rrdp-publication/*/deltas/*.xml")) for snapshot in sorted(snapshots): - time.sleep(1) - run("rm", "-rf", "rcynic-data") - run(rrdp_test_tool, snapshots[snapshot]) - run(rcynic, "-c", "rcynic-rrdp.conf") - run(rcynic_text, "rcynic.xml") - - for delta in sorted(deltas): - if delta > snapshot: - time.sleep(1) - run(rrdp_test_tool, deltas[delta]) - run(rcynic, "-c", "rcynic-rrdp.conf") - run(rcynic_text, "rcynic.xml") - - if not args.exhaustive: - break + time.sleep(1) + run("rm", "-rf", "rcynic-data") + run(rrdp_test_tool, snapshots[snapshot]) + run(rcynic, "-c", "rcynic-rrdp.conf") + run(rcynic_text, "rcynic.xml") + + for delta in sorted(deltas): + if delta > snapshot: + time.sleep(1) + run(rrdp_test_tool, deltas[delta]) + run(rcynic, "-c", "rcynic-rrdp.conf") + run(rcynic_text, "rcynic.xml") + + if not args.exhaustive: + break -- cgit v1.2.3