aboutsummaryrefslogtreecommitdiff
path: root/goodfile
blob: f5e6f0940ef6b62337e94f8905ae38745560844b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
if not Build.environment.has("rustup")
then
  Build.error("i don't know i want to handle dependencies yet")
end

Build.metric(
  "nightly version",
  "rustc --version"
)

Build.run({"cargo", "build"}, {step="build"}) -- `run` automatically records stdout and stderr to log files named after the command
Build.run({"cargo", "test"}, {step="test", name="test stdlib/fmt"}) -- artifacts are stored under `name` if that's present
Build.run({"cargo", "test", "--no-default-features"}, {step="test", name="test nostdlib/nofmt"})
Build.run({"cargo", "test", "--no-default-features", "--features", "fmt"}, {step="test", name="test nostdlib/fmt"})

Build.run({"cargo", "+nightly", "build", "-Z", "build-std", "--release", "--no-default-features", "--target", "x86_64-unknown-linux-gnu"}, {step="ffi_build", cwd="ffi/"})

sopath = "ffi/target/x86_64-unknown-linux-gnu/release/libyaxpeax_x86_ffi_long_mode.so"
Build.run({"ls", sopath}, {step="ffi_validate"})
Build.metric(
  "libyaxpeax_x86_ffi_long_mode.so size (bytes)",
  Build.environment.size(sopath)
)
Build.artifact(sopath)

-- now run some perf numbers...
Build.run({"git", "clone", "https://github.com/athre0z/disas-bench.git", "disas-bench"})
Build.run({"git", "submodule", "update", "--recursive", "--init"}, {cwd="disas-bench"})
Build.run({"git", "remote", "add", "dev", "../../.."}, {cwd="disas-bench/libs/yaxpeax"})
Build.run({"git", "fetch", "-a", "dev"}, {cwd="disas-bench/libs/yaxpeax"})
Build.run({"git", "checkout", Build.sha}, {cwd="disas-bench/libs/yaxpeax"})
Build.run({"make", "make-bench-yaxpeax"}, {cwd="disas-bench/bench/yaxpeax"})

Build.metric(
  "bench-yaxpeax-fmt size (bytes)",
  Build.environment.size("disas-bench/bench/yaxpeax/bench-yaxpeax-fmt")
)

Build.metric(
  "bench-yaxpeax-no-fmt size (bytes)",
  Build.environment.size("disas-bench/bench/yaxpeax/bench-yaxpeax-no-fmt")
)

-- fmt
bench_start = Build.now_ms()

Build.run({"./bench-yaxpeax-fmt", "20", "0x400", "0x2460400", "../../input/xul.dll"}, {cwd="disas-bench/bench/yaxpeax"})

bench_end = Build.now_ms()
Build.metric("fmt runtime (ms)", bench_end - bench_start)

-- no-fmt
bench_start = Build.now_ms()

Build.run({"./bench-yaxpeax-no-fmt", "20", "0x400", "0x2460400", "../../input/xul.dll"}, {cwd="disas-bench/bench/yaxpeax"})

bench_end = Build.now_ms()
Build.metric("no-fmt runtime (ms)", bench_end - bench_start)