-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate-results.sh
More file actions
executable file
·35 lines (28 loc) · 926 Bytes
/
generate-results.sh
File metadata and controls
executable file
·35 lines (28 loc) · 926 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
29
30
31
32
33
34
35
#!/bin/bash -e
# This script will substitute the benchmark results into the HTML page.
# Note: editing HTML with sed may look strange, but at least we avoid using node.js and npm, and that's good.
# This is needed on Mac OS. Do `brew install coreutils`.
if [[ "$(uname)" == "Darwin" ]]; then
if ! command -v gsed >/dev/null 2>&1
then
echo "On macOS, please install GNU sed through homebrew."
exit 1
else
shopt -s expand_aliases
alias sed='gsed'
fi
fi
(
sed '/^const data = \[$/q' index.html
FIRST=1
LANG="" ls -1 */results*/*.json | while read -r file
do
[ "${FIRST}" = "0" ] && echo -n ','
jq --compact-output ". += {\"source\": \"${file}\"}" "${file}" || echo "Error in $file" >&2
FIRST=0
done
echo ']; // end of data'
sed '0,/^\]; \/\/ end of data$/d' index.html
) > index.html.new
mv index.html index.html.bak
mv index.html.new index.html