-
Notifications
You must be signed in to change notification settings - Fork 3
/
justfile
114 lines (97 loc) · 3.21 KB
/
justfile
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
112
113
114
# -*-Makefile-*-
# Run all tests in hand-written loop: more informative and colourful than ctest
test-all *FLAGS:
just test '' {{FLAGS}}
# Need to run each test in a separate process, otherwise the monolithic and
# persistent Geant4 Run and Kernel managers will make things go wrong.
# Run a selection of tests
test PATTERN *FLAGS: build
#!/usr/bin/env bash
cd abracadabra/build
NPASSED=0
NFAILED=0
FAILED=
while read -r testname
do
if ! ./tests-trial "$testname" {{FLAGS}}; then
FAILED=$FAILED"$testname"\\n
NFAILED=$((NFAILED+1))
else
NPASSED=$((NPASSED+1))
fi
done < <(./tests-trial {{PATTERN}} --list-test-names-only)
if ! [ -z "$FAILED" ]; then
printf "\\033[91m===========================================================================\n"
printf "\\033[32m Passed $NPASSED tests, \\033[91m Failed $NFAILED\n\n"
printf "\\033[91m Failures: \n\n$FAILED\n"
printf "\\033[91m===========================================================================\n"
printf "\\033[91mOVERALL: ============================== FAIL ==============================\n"
printf "\\033[91m===========================================================================\n"
printf "\\033[0m"
exit 1
else
printf "\\033[32m Ran $NPASSED tests\n\n"
printf "\\033[32m===========================================================================\n"
printf "\\033[32mOVERALL: ============================== PASS ==============================\n"
printf "\\033[32m===========================================================================\n"
printf "\\033[0m"
fi
# TODO Add mechanism for overriding setting in macros, on the `just` CLI
# Load macs/<model>.mac and run macs/<run>.mac in batch mode
run model='model' run='run': build
#!/usr/bin/env sh
cd abracadabra/build
./abracadabra macs/{{model}}.mac macs/{{run}}.mac
# Like `run` but without fully explicit macro file names
run-full-path model run: build
#!/usr/bin/env sh
cd abracadabra/build
./abracadabra {{model}} {{run}}
# Load <model> in interactive mode
interact model='model': build
#!/usr/bin/env sh
cd abracadabra/build
./abracadabra macs/{{model}}.mac
# Load <model> and run <run> in batch mode
run-debug model='model' run='run': build
#!/usr/bin/env sh
cd abracadabra/build
gdb --args ./abracadabra macs/{{model}}.mac macs/{{run}}.mac
# Load <model> in interactive mode
interact-debug model='model': build
#!/usr/bin/env sh
cd abracadabra/build
gdb --args ./abracadabra macs/{{model}}.mac
# List available model configurations
list-models:
#!/usr/bin/env sh
cd abracadabra/macs
ls -1 *model.mac | sed 's/.mac//g'
# List available run configurations
list-runs:
#!/usr/bin/env sh
cd abracadabra/macs
ls -1 *run.mac | sed 's/.mac//g'
# List available model and run configurations
list-macros: list-models list-runs
build: cmake
#!/usr/bin/env sh
cd abracadabra/build && cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo . && make -j
clean:
rm abracadabra/build -rf
cmake:
#!/usr/bin/env sh
if ! [ -d abracadabra/build ]; then
mkdir abracadabra/build
cd abracadabra/build
cmake ..
fi
# Test with ctest
ctest: build
#!/usr/bin/env sh
cd abracadabra/build
ctest
list-tests: build
#!/usr/bin/env sh
cd abracadabra/build
./tests-trial --list-test-names-only