3 # This is a convenience script for running some of the other tests without
4 # manual intervention, as a means of a fast and easy correctness test.
6 # If you are making an intrusive or risky change, please take the time to run
7 # the other tests by hand with more intensive parameters, and check the
8 # coverage and use the other tools mentioned in the README.
16 # Go to our directory, which we will use to find the other tools
17 os
.chdir(os
.path
.dirname(sys
.argv
[0]))
19 if len(sys
.argv
) != 2 or sys
.argv
[1] not in ("normal", "fiu"):
20 sys
.stderr
.write("Usage: %s [normal|fiu]" %
21 os
.path
.basename(sys
.argv
[0]))
24 def run_behaviour_tests(test_type
):
25 ret
= subprocess
.call(["./wrap-python", "2", "../behaviour/runtests",
30 def run_stress_tests(nops
= 0, nprocs
= 0, fi
= False, fsize
= 20):
31 # Create a temporary path. We can't use os.tempnam() because it emits
32 # a warning about a security risk, although it is safe for us because
33 # of how jiostress opens the file.
34 tmp_path
= "%s/libjio-tests-%d-%d" % ( \
35 os
.environ
.get("TMPDIR", "/tmp"),
37 random
.randint(0, 1000000000))
39 args
= ["./wrap-python", "3", "../stress/jiostress",
42 args
+= ["-n", str(nops
)]
44 args
+= ["-p", str(nprocs
)]
48 ret
= subprocess
.call(args
)
52 if sys
.argv
[1] == "normal":
53 print "behaviour tests (normal)"
54 run_behaviour_tests("normal")
56 print "stress tests (normal)"
57 run_stress_tests(nops
= 50, nprocs
= 3)
59 print "behaviour tests (all)"
60 run_behaviour_tests("all")
62 print "stress tests (normal)"
63 run_stress_tests(nops
= 50, nprocs
= 3)
65 print "stress tests (fiu)"
66 run_stress_tests(nops
= 400, fi
= True)
70 print "Tests completed successfuly"