OILS / testdata / control-flow-graph.sh View on Github | oilshell.org

37 lines, 28 significant
1#!/usr/bin/env bash
2
3: ${LIB_OSH=stdlib/osh}
4source $LIB_OSH/bash-strict.sh
5source $LIB_OSH/task-five.sh
6
7REPO_ROOT=$(cd "$(dirname $0)/.."; pwd)
8readonly REPO_ROOT
9
10source build/common.sh
11
12generate_one() {
13 pushd $REPO_ROOT
14 local mycpp=_bin/shwrap/mycpp_main
15 ninja $mycpp
16
17 local ex=$1
18 shift
19 $mycpp '.:pyext' _tmp/mycpp-cfg-testdata mycpp/examples/"${ex}.py"
20
21 mkdir -p testdata/control-flow-graph/$ex
22 for fact in "$@";
23 do
24 local fact_file="${fact}.facts"
25 cp _tmp/mycpp-facts/$fact_file testdata/control-flow-graph/$ex/$fact_file
26 done
27 popd
28}
29
30generate_all() {
31 generate_one control_flow cf_edge
32 generate_one scoped_resource cf_edge
33 generate_one test_switch cf_edge
34 generate_one classes assign define
35}
36
37task-five "$@"