OILS / devtools / test-oils.sh View on Github | oilshell.org

90 lines, 26 significant
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
26set -o nounset
27set -o pipefail
28set -o errexit
29
30osh-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
41demo() {
42 local oils_version
43 oils_version=$(head -n 1 oil-version.txt)
44
45 local time_py="$PWD/benchmarks/time_.py"
46
47 build/py.sh time-helper
48
49 # Extract and compile the tarball
50 # Similar to devtools/release-native.sh test-tar
51
52 local tmp=_tmp/xshar-demo
53 mkdir -p $tmp
54
55 pushd $tmp
56 tar -x < ../../_release/oils-for-unix.tar
57
58 pushd oils-for-unix-$oils_version
59 build/native.sh tarball-demo
60
61 # TODO: use benchmarks/time_.py
62 # TODO: compile time-helper.c
63
64 local osh=$PWD/_bin/cxx-opt-sh/osh
65
66 $time_py --tsv --rusage -o demo.tsv -- $osh -c 'sleep 0.1; echo "hi from osh"'
67 cat demo.tsv
68
69 popd
70
71 popd
72
73 #time OILS_GC_STATS=1 $osh Python-2.7.13/configure
74}
75
76main() {
77 # TODO
78 #
79 # - Extract oils tarball, compile it
80 # - Run "$@"
81 #
82 # test-oils.xshar benchmarks/osh-runtime.sh xshar-main
83 #
84 # - benchmarks/osh-runtime.sh will create TSV files
85 # - then it can upload them to a server
86
87 echo 'Hello from test-oils.sh'
88}
89
90"$@"