| 1 | #!/usr/bin/env bash
 | 
| 2 | #
 | 
| 3 | # Survey code: toward a common test/benchmark framework.
 | 
| 4 | #
 | 
| 5 | # Usage:
 | 
| 6 | #   test/all.sh <function name>
 | 
| 7 | 
 | 
| 8 | set -o nounset
 | 
| 9 | set -o pipefail
 | 
| 10 | set -o errexit
 | 
| 11 | 
 | 
| 12 | grep-time-tool() {
 | 
| 13 | 
 | 
| 14 |   # Current users:
 | 
| 15 |   #   benchmarks/
 | 
| 16 |   #     gc,osh-runtime,ovm-build
 | 
| 17 |   #   build/
 | 
| 18 |   #     ninja-rules-py.sh  # for mycpp-logs-equal
 | 
| 19 |   #   soil/
 | 
| 20 |   #     worker.sh
 | 
| 21 |   #   test/
 | 
| 22 |   #     stateful,unit
 | 
| 23 | 
 | 
| 24 |   egrep --color -n 'time-tsv' */*.sh
 | 
| 25 | 
 | 
| 26 |   echo
 | 
| 27 | 
 | 
| 28 |   # benchmarks/
 | 
| 29 |   #   osh-parser/
 | 
| 30 |   egrep --color -n 'benchmarks/time_.py' */*.sh
 | 
| 31 | 
 | 
| 32 |   echo
 | 
| 33 | 
 | 
| 34 |   # benchmarks/ovm-build has more for time-tsv
 | 
| 35 |   egrep --color -n 'TIME_PREFIX' */*.sh
 | 
| 36 | }
 | 
| 37 | 
 | 
| 38 | grep-print-tasks() {
 | 
| 39 | 
 | 
| 40 |   # Current users:
 | 
| 41 |   #   benchmarks/
 | 
| 42 |   #    gc,osh-parser,osh-runtime,uftrace,vm-baseline
 | 
| 43 |   #
 | 
| 44 |   # Should use it:
 | 
| 45 |   #   benchmarks/
 | 
| 46 |   #     compute/
 | 
| 47 |   #   test/
 | 
| 48 |   #     stateful/
 | 
| 49 |   #     wild.sh  # has 'all' function
 | 
| 50 | 
 | 
| 51 |   # Using Python programs:
 | 
| 52 |   #  spec/*  uses sh_spec.py
 | 
| 53 |   #  spec/stateful/{signals,job_control,...}.py
 | 
| 54 | 
 | 
| 55 |   egrep --color -n 'print-tasks' */*.sh
 | 
| 56 | }
 | 
| 57 | 
 | 
| 58 | grep-soil-run() {
 | 
| 59 |   # It would be nice to make these more fine-grained
 | 
| 60 | 
 | 
| 61 |   egrep --color -n '^soil-run' */*.sh
 | 
| 62 | 
 | 
| 63 |   echo
 | 
| 64 | 
 | 
| 65 |   egrep --color -n '^run-for-release' */*.sh
 | 
| 66 | }
 | 
| 67 | 
 | 
| 68 | all-print-tasks() {
 | 
| 69 |   # All benchmarks and tests should use this style!
 | 
| 70 |   #
 | 
| 71 |   # Then we can time, status, stdout / output files consistentely.
 | 
| 72 | 
 | 
| 73 |   # Only prints a single column now!
 | 
| 74 |   benchmarks/uftrace.sh print-tasks
 | 
| 75 | 
 | 
| 76 |   echo
 | 
| 77 | 
 | 
| 78 |   # Modern style
 | 
| 79 |   benchmarks/gc.sh print-tasks
 | 
| 80 | 
 | 
| 81 |   echo
 | 
| 82 | 
 | 
| 83 |   # Modern style of benchmark
 | 
| 84 |   benchmarks/osh-runtime.sh print-tasks 'no-host' '_bin/cxx-dbg/osh'
 | 
| 85 | 
 | 
| 86 |   return
 | 
| 87 | 
 | 
| 88 |   # requires provenance
 | 
| 89 |   benchmarks/osh-parser.sh print-tasks
 | 
| 90 | }
 | 
| 91 | 
 | 
| 92 | "$@"
 |