forked from kostya/benchmarks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·56 lines (44 loc) · 1.13 KB
/
run.sh
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
#!/bin/sh -xe
docker_build="docker build docker/ -t benchmarks"
docker_run="docker run -it --rm -v $PWD:/src benchmarks"
exit_trap_command=""
tear_down() {
eval "$exit_trap_command"
}
trap tear_down EXIT
add_exit_trap() {
to_add=$1
if [ "$exit_trap_command" ]; then
exit_trap_command="$exit_trap_command; $to_add"
else
exit_trap_command="$to_add"
fi
}
build() {
eval "$docker_build"
}
rebuild() {
eval "$docker_build --no-cache"
}
shell() {
# TODO: apply the proper solution (probably by using the privileged monitor)
# References (CVE-2020-8694): https://lists.debian.org/debian-lts-announce/2020/12/msg00015.html
old_mode=$(stat -c "%a" /sys/class/powercap/intel-rapl/intel-rapl:0/energy_uj)
energy_uj=/sys/class/powercap/intel-rapl/intel-rapl:0/energy_uj
chmod 0444 "$energy_uj"
add_exit_trap "chmod $old_mode $energy_uj"
eval "$docker_run shell"
}
versions() {
eval "$docker_run versions"
}
toc() {
git-md-toc -u README.md
}
update_apt() {
./docker/update_apt.rb docker/apt.pkgs
}
lint() {
docker run --rm -i hadolint/hadolint < docker/Dockerfile
}
"$@"