Skip to content

Commit 2c1bb19

Browse files
committed
benchmark: WIP: Add more functionality on top of gitko
1 parent 3c410e2 commit 2c1bb19

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

misc/benchmark.jk

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
incl gitko
2+
13
func print_usage() -> NoReturn {
24
println_err("Usage: ./benchmark.jk <commit1> <commit2>");
35
println_err("This program compares the performance of the jinko interpreter between");
@@ -11,10 +13,7 @@ cli_args = args()
1113
f_commit = cli_args.at(0)
1214
s_commit = cli_args.at(1)
1315

14-
// FIXME: Ugly
15-
arg_equals_two = cli_args.amount() != 2;
16-
17-
if arg_equals_two {
16+
if cli_args.amount() != 2 {
1817
println_err("benchmark.jk: invalid argument amount");
1918
print_usage();
2019
}
@@ -23,3 +22,23 @@ if f_commit.equals(s_commit) {
2322
println_err("benchmark.jk: the two given commits should be different");
2423
print_usage();
2524
}
25+
26+
jk_repo = Git(path: ".");
27+
28+
// FIXME: Add the following
29+
// original_commit = jk_repo.current_commit();
30+
31+
func checkout_and_test(hash: string) {
32+
if jk_repo.checkout(commit(hash)) {
33+
cmd("sh").with_arg("-c").with_arg("tests/func_tests.sh").execute();
34+
} else {
35+
// FIXME: Use string formatting here...
36+
println_err("benchmark.jk: invalid commit: ".concat(hash));
37+
print_usage();
38+
}
39+
}
40+
41+
checkout_and_test(f_commit);
42+
checkout_and_test(s_commit);
43+
44+
// FIXME: Switch back to the original commit

0 commit comments

Comments
 (0)