-
Notifications
You must be signed in to change notification settings - Fork 99
/
vm-test-build-copy.sh
executable file
·81 lines (67 loc) · 4.39 KB
/
vm-test-build-copy.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
# copies wasm & scenarios files to the Arwen test folder
# expects 1 argument: the path to the Arwen repo root
VM_REPO_PATH=${1:?"Missing VM repo path!"}
TARGET_DIR=$PWD/target
build_and_copy() {
contract_path=$1
contract_name=${contract_path##*/}
vm_contract_path=$2
sc-meta all build --target-dir $TARGET_DIR --path $contract_path || return 1
mkdir -p $vm_contract_path/output
cp $contract_path/output/*.mxsc.json \
$vm_contract_path/output
rm $vm_contract_path/output/*.wasm
}
build_and_copy_with_scenarios() {
contract_path=$1
contract_name=${contract_path##*/}
vm_contract_path=$2
sc-meta all build --target-dir $TARGET_DIR --path $contract_path || return 1
mkdir -p $vm_contract_path/output
rm -rf $vm_contract_path/scenarios
cp $contract_path/output/*.mxsc.json \
$vm_contract_path/output
rm $vm_contract_path/output/*.wasm
# copying scenarios ...
rsync -av \
$contract_path/scenarios/ \
$vm_contract_path/scenarios/
}
# building all contracts takes a lot of time, only the ones for the wasm-vm tests are built below
# if you still want to build all:
# ./build-wasm.sh
build_and_copy_with_scenarios ./contracts/core/wegld-swap $VM_REPO_PATH/test/wegld-swap
build_and_copy_with_scenarios ./contracts/examples/adder $VM_REPO_PATH/test/adder
build_and_copy_with_scenarios ./contracts/examples/crowdfunding-esdt $VM_REPO_PATH/test/crowdfunding-esdt
build_and_copy_with_scenarios ./contracts/examples/digital-cash $VM_REPO_PATH/test/digital-cash
build_and_copy_with_scenarios ./contracts/examples/factorial $VM_REPO_PATH/test/factorial
build_and_copy_with_scenarios ./contracts/examples/ping-pong-egld $VM_REPO_PATH/test/ping-pong-egld
build_and_copy_with_scenarios ./contracts/examples/multisig $VM_REPO_PATH/test/multisig
build_and_copy_with_scenarios ./contracts/feature-tests/alloc-features $VM_REPO_PATH/test/features/alloc-features
build_and_copy_with_scenarios ./contracts/feature-tests/basic-features $VM_REPO_PATH/test/features/basic-features
build_and_copy_with_scenarios ./contracts/feature-tests/big-float-features $VM_REPO_PATH/test/features/big-float-features
build_and_copy_with_scenarios ./contracts/feature-tests/erc-style-contracts/erc20 $VM_REPO_PATH/test/erc20-rust
build_and_copy_with_scenarios ./contracts/feature-tests/formatted-message-features $VM_REPO_PATH/test/features/formatted-message-features
build_and_copy_with_scenarios ./contracts/feature-tests/payable-features $VM_REPO_PATH/test/features/payable-features
build_and_copy_with_scenarios ./contracts/feature-tests/esdt-system-sc-mock $VM_REPO_PATH/test/features/esdt-system-sc-mock
build_and_copy_composability() {
contract=$1
contract_with_underscores="${contract//-/_}"
sc-meta all build --target-dir $TARGET_DIR --path ./contracts/feature-tests/composability/$contract || return 1
cp -R contracts/feature-tests/composability/$contract/output/${contract}.mxsc.json \
$VM_REPO_PATH/test/features/composability/$contract/output/${contract}.mxsc.json
rm contracts/feature-tests/composability/$contract/output/*.wasm
}
build_and_copy ./contracts/feature-tests/composability/builtin-func-features $VM_REPO_PATH/test/features/composability/builtin-func-features
build_and_copy ./contracts/feature-tests/composability/forwarder $VM_REPO_PATH/test/features/composability/forwarder
build_and_copy ./contracts/feature-tests/composability/forwarder-queue $VM_REPO_PATH/test/features/composability/forwarder-queue
build_and_copy ./contracts/feature-tests/composability/forwarder-raw $VM_REPO_PATH/test/features/composability/forwarder-raw
build_and_copy ./contracts/feature-tests/composability/proxy-test-first $VM_REPO_PATH/test/features/composability/proxy-test-first
build_and_copy ./contracts/feature-tests/composability/proxy-test-second $VM_REPO_PATH/test/features/composability/proxy-test-second
build_and_copy ./contracts/feature-tests/composability/recursive-caller $VM_REPO_PATH/test/features/composability/recursive-caller
build_and_copy ./contracts/feature-tests/composability/promises-features $VM_REPO_PATH/test/features/composability/promises-features
build_and_copy ./contracts/feature-tests/composability/vault $VM_REPO_PATH/test/features/composability/vault
rm -f $VM_REPO_PATH/test/features/composability/scenarios/*
cp -R contracts/feature-tests/composability/scenarios \
$VM_REPO_PATH/test/features/composability