1 | #!/usr/bin/env bash
|
2 |
|
3 | : ${LIB_OSH=stdlib/osh}
|
4 | source $LIB_OSH/bash-strict.sh
|
5 | source $LIB_OSH/task-five.sh
|
6 |
|
7 | REPO_ROOT=$(cd "$(dirname $0)/.."; pwd)
|
8 | readonly REPO_ROOT
|
9 |
|
10 | source build/common.sh
|
11 |
|
12 | generate_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 |
|
30 | generate_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 |
|
37 | task-five "$@"
|