1 | #!/usr/bin/env bash
|
2 | #
|
3 | # Main file for test-oils.xshar
|
4 | #
|
5 | # Usage:
|
6 | # devtools/test-oils.sh <function name>
|
7 | #
|
8 | # It will contain
|
9 | #
|
10 | # _release/
|
11 | # oils-for-unix.tar
|
12 | # benchmarks/
|
13 | # time-helper.c
|
14 | # osh-runtime.sh
|
15 | #
|
16 | # It will run benchmarks, and then upload a TSV file to a server.
|
17 | #
|
18 | # The TSV file will be labeled with
|
19 | #
|
20 | # - git commit that created the xshar file (in oilshell/oil)
|
21 | # - date
|
22 | # - label: github actions / sourcehut
|
23 | # - and then we'll also have provenance and system info
|
24 | # - machine name, OS, CPUs, etc.
|
25 |
|
26 | set -o nounset
|
27 | set -o pipefail
|
28 | set -o errexit
|
29 |
|
30 | OILS_VERSION=$(head -n 1 oil-version.txt)
|
31 |
|
32 | osh-runtime() {
|
33 | benchmarks/osh-runtime.sh test-oils-run
|
34 | }
|
35 |
|
36 | demo() {
|
37 | local time_py="$PWD/benchmarks/time_.py"
|
38 |
|
39 | build/py.sh time-helper
|
40 |
|
41 | # Extract and compile the tarball
|
42 | # Similar to devtools/release-native.sh test-tar
|
43 |
|
44 | local tmp=_tmp/xshar-demo
|
45 | mkdir -p $tmp
|
46 |
|
47 | pushd $tmp
|
48 | tar -x < ../../_release/oils-for-unix.tar
|
49 |
|
50 | pushd oils-for-unix-$OILS_VERSION
|
51 | build/native.sh tarball-demo
|
52 |
|
53 | local osh=$PWD/_bin/cxx-opt-sh/osh
|
54 |
|
55 | $time_py --tsv --rusage -o demo.tsv -- \
|
56 | $osh -c 'sleep 0.1; echo "hi from osh"'
|
57 | cat demo.tsv
|
58 |
|
59 | popd
|
60 |
|
61 | popd
|
62 |
|
63 | #time OILS_GC_STATS=1 $osh Python-2.7.13/configure
|
64 | }
|
65 |
|
66 | main() {
|
67 | # TODO
|
68 | #
|
69 | # - Extract oils tarball, compile it
|
70 | # - Run "$@"
|
71 | #
|
72 | # test-oils.xshar benchmarks/osh-runtime.sh xshar-main
|
73 | #
|
74 | # - benchmarks/osh-runtime.sh will create TSV files
|
75 | # - then it can upload them to a server
|
76 |
|
77 | echo 'Hello from test-oils.sh'
|
78 | }
|
79 |
|
80 | "$@"
|