-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdc
executable file
·111 lines (99 loc) · 3.5 KB
/
dc
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/env ruby
require File.join(File.dirname(__FILE__), "tools", "cli")
README = <<-Q
# DockerCompose benchmark tool
# Require docker-compose-plugin v2, check if it installed: run `docker compose version`, version should be v2.xxx
# Else install it from here: https://docs.docker.com/engine/install/ubuntu/#set-up-the-repository
# commands:
./dc new # create new round of testing
./dc init [LANG, ] # build docker containers
./dc up [LANG, ] # up docker containers into background
./dc versions [LANG, ] # print versions list (require up)
./dc build [BENCH, ] [LANG, ] # build source code into target/ folders (require up)
./dc check [BENCH, ] [LANG, ] # run checks, that all code works fine (require up)
./dc run [BENCH, ] [LANG, ] # run benchmaks (require up)
./dc down # down docker containers
./dc readme [BENCH, ] [LANG, ] # generate readme
./dc shell LANG # enter into shell
# aggregate command:
./dc round [BENCH, ] [LANG, ] # execute commands in order (new, init, up, versions, build, check, run, down, readme)
--------------------------------------------------------------
# Example build all docker containers:
./dc init
# Example enter shell crystal lang
./dc shell crystal
# Example run full round of testing:
./dc round
# Example run 2 benchmarks for all languages:
./dc round binarytrees,fasta
# Example run 2 languages through all benchmarks (build only needed containers, useful because not spend much time):
./dc round all ruby,crystal
--------------------------------------------------------------
# Using env variables for special settings
DC_DEBUG=1 # enables some additional debug outputs
DC_TIMEOUT=10 # set special timeout, ex: `DC_TIMEOUT=10 ./dc run`
DC_ARCH=aarch64 # set arch, needed only if it detected incorrect
DC_COUNT=3 # set runs count, default: 5
Q
case cmd = ARGV.shift
when "init", "i", "in"
# Build docker containers
# ./dc init
# ./dc init all
# ./dc init crystal,ruby
CLI.new.init(ARGV[0], ARGV[1] == "--force-rebuild")
when "up", "u"
# ./dc up
# ./dc up all
# ./dc up crystal,ruby
CLI.new.up(ARGV[0])
when "down", "d"
CLI.new.down
when "ps"
puts `docker compose ps`
when "build", "b", "bu", "bui"
# ./dc build
# ./dc build all all
# ./dc build binarytrees,fasta crystal,ruby
CLI.new.build(ARGV[0], ARGV[1])
when "check", "c", "ch", "che"
# ./dc check
# ./dc check all all
# ./dc check binarytrees,fasta crystal,ruby
CLI.new.check(ARGV[0], ARGV[1])
when "run", "r", "ru"
# ./dc run
# ./dc run all all
# ./dc run binarytrees,fasta crystal,ruby
CLI.new.run(ARGV[0], ARGV[1])
when "clean", "cl", "cle"
# Remove target folders
# sudo needed because target folder have subfolders with root rights, because created in docker
# sudo ./dc clean
# sudo ./dc clean all
# sudo ./dc clean binarytrees
CLI.new.clean(ARGV[0])
when "versions", "v", "ver", "vers"
# ./dc versions
# ./dc versions all
# ./dc versions ruby,crystal
CLI.new.versions(ARGV[0])
when "readme", "re", "rea"
CLI.new.readme(ARGV[0], ARGV[1])
when "new", "n"
CLI.new.new_round
when "round", "ro", "rou"
CLI.new.round(ARGV[0], ARGV[1])
when "languages_list"
puts CLI.new.send(:langs_from_str, ARGV[0]).join(' ')
when "containers_list"
puts CLI.new.send(:build_containers, ARGV[0]).join(' ')
when "benchmarks_list"
puts CLI.new.send(:benchmarks_from_str, ARGV[0]).join(' ')
when "shell"
CLI.new.shell(ARGV[0])
when "h", "help", "-h", "--help"
puts README
else
puts README
end