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 | osh-runtime() {
|
31 | # Extract and compile the tarball
|
32 | devtools/release-native.sh test-tar
|
33 | # TODO: compile time-helper.c
|
34 |
|
35 | # TODO: call benchmarks/osh-runtime to measure
|
36 | #
|
37 | # Upload TSV files
|
38 | # Where?
|
39 | }
|
40 |
|
41 | demo() {
|
42 | local oils_version
|
43 | oils_version=$(head -n 1 oil-version.txt)
|
44 |
|
45 | # Extract and compile the tarball
|
46 | # Similar to devtools/release-native.sh test-tar
|
47 |
|
48 | local tmp=_tmp/xshar-demo
|
49 | mkdir -p $tmp
|
50 |
|
51 | pushd $tmp
|
52 | tar -x < ../../_release/oils-for-unix.tar
|
53 |
|
54 | pushd oils-for-unix-$oils_version
|
55 | build/native.sh tarball-demo
|
56 |
|
57 | # TODO: use benchmarks/time_.py
|
58 | # TODO: compile time-helper.c
|
59 | time _bin/cxx-opt-sh/osh -c 'sleep 0.1; echo "hi from osh"'
|
60 | popd
|
61 |
|
62 | popd
|
63 | }
|
64 |
|
65 | main() {
|
66 | # TODO
|
67 | #
|
68 | # - Extract oils tarball, compile it
|
69 | # - Run "$@"
|
70 | #
|
71 | # test-oils.xshar benchmarks/osh-runtime.sh xshar-main
|
72 | #
|
73 | # - benchmarks/osh-runtime.sh will create TSV files
|
74 | # - then it can upload them to a server
|
75 |
|
76 | echo 'Hello from test-oils.sh'
|
77 | }
|
78 |
|
79 | "$@"
|