forked from AU-COBRA/ConCert
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocess-extraction-examples.sh
executable file
·50 lines (42 loc) · 1.53 KB
/
process-extraction-examples.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
LIQ_PATH=./tests/extracted-code/liquidity-extract
LIGO_PATH=./tests/extracted-code/cameligo-extract
MID_PATH=./tests/extracted-code/midlang-extract
CONCORDIUM_PATH=./tests/extracted-code/concordium-extract
LIQ_TESTS=$LIQ_PATH/tests
LIGO_TESTS=$LIGO_PATH/tests
MID_TESTS=$MID_PATH/tests
echo "Processing Liquidity extraction"
for f in $LIQ_PATH/*.liq.out;
do
if [[ ! -e "$f" ]]; then continue; fi
echo $f "--->" $LIQ_TESTS/$(basename ${f%.out}) ;
sed -n 's/ *"//;/\(*START*\)/,/\(*END*\)/p' $f > $LIQ_TESTS/$(basename ${f%.out})
done
echo "Processing LIGO extraction"
for f in $LIGO_PATH/*.mligo.out;
do
if [[ ! -e "$f" ]]; then continue; fi
echo $f "--->" $LIGO_TESTS/$(basename ${f%.out}) ;
cp ${f} $LIGO_TESTS/$(basename ${f%.out})
done
echo "Processing Midlang extraction"
for f in $MID_PATH/*.midlang.out;
do
if [[ ! -e "$f" ]]; then continue; fi
echo $f "--->" $MID_TESTS/$(basename ${f%.out}) ;
cp $f $MID_TESTS/$(basename ${f%.out})
done
echo "Processing Rust Concordium extraction"
concordium_contracts="counter interp escrow"
CONCORDIUM_SUFFIX=extracted/src/lib.rs
CONCORDIUM_TESTS=extracted/src/tests.rs
for f in ${concordium_contracts}
do
if [[ ! -e "$CONCORDIUM_PATH/${f}.rs.out" ]]; then continue; fi
fname=$CONCORDIUM_PATH/${f}-${CONCORDIUM_SUFFIX}
echo "removing previous extraction: " ${fname}
rm -f ${fname}
echo "Processing ${CONCORDIUM_PATH}/${f}.rs.out + tests.rs --> ${fname}"
cat $CONCORDIUM_PATH/${f}.rs.out $CONCORDIUM_PATH/${f}-${CONCORDIUM_TESTS} > ${fname}
done