-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
28 lines (23 loc) · 836 Bytes
/
Copy pathTaskfile.yml
File metadata and controls
28 lines (23 loc) · 836 Bytes
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
version: '3'
tasks:
benchmark:
desc: 'Run the Go benchmark for a single task and write it to that task''s go/benchmark.txt. Usage: task benchmark -- N'
silent: true
cmds:
- |
if [ -z "{{.CLI_ARGS}}" ]; then
echo "Usage: task benchmark -- <task number>" >&2
exit 1
fi
NUM=$(printf "%03d" "{{.CLI_ARGS}}")
DIR=$(find tasks_* -maxdepth 1 -type d -name "task_${NUM}" | head -1)
if [ -z "$DIR" ]; then
echo "Task ${NUM} not found (expected tasks_XXX-YYY/task_${NUM})" >&2
exit 1
fi
if [ ! -d "$DIR/go" ]; then
echo "No go/ solution found for task ${NUM} at $DIR" >&2
exit 1
fi
go test "./$DIR/go" -bench=. -benchmem | cat > "$DIR/go/benchmark.txt"
cat "$DIR/go/benchmark.txt"