@@ -12,11 +12,12 @@ cleanup () {
12
12
if [ -n " $PARSEC_PID " ]; then kill $PARSEC_PID || true ; fi
13
13
# Stop tpm_server if running
14
14
if [ -n " $TPM_SRV_PID " ]; then kill $TPM_SRV_PID || true ; fi
15
- # Remove the slot_number line added by find_slot_number.sh
16
- sed -i ' /^slot_number =.*/d ' $CONFIG_PATH
15
+ # Remove the slot_number line added earlier
16
+ find e2e_tests -name " *toml " -not -name " Cargo.toml " -exec sed -i ' s /^slot_number =.*/# slot_number/ ' {} \;
17
17
# Remove fake mapping and temp files
18
- if [ -d " mappings" ]; then rm -rf -- " mappings" ; fi
19
- if [ -f " NVChip" ]; then rm " NVChip" ; fi
18
+ rm -rf " mappings"
19
+ rm -f " NVChip"
20
+ rm -f " e2e_tests/provider_cfg/tmp_config.toml"
20
21
21
22
if [ -z " $NO_CARGO_CLEAN " ]; then cargo clean; fi
22
23
}
@@ -50,6 +51,7 @@ error_msg () {
50
51
NO_CARGO_CLEAN=
51
52
NO_STRESS_TEST=
52
53
PROVIDER_NAME=
54
+ CONFIG_PATH=$( pwd) /e2e_tests/provider_cfg/tmp_config.toml
53
55
while [ " $# " -gt 0 ]; do
54
56
case " $1 " in
55
57
--no-cargo-clean )
@@ -63,7 +65,7 @@ while [ "$#" -gt 0 ]; do
63
65
error_msg " Only one provider name must be given"
64
66
fi
65
67
PROVIDER_NAME=$1
66
- CONFIG_PATH= " e2e_tests/provider_cfg/$1 /config.toml"
68
+ cp $( pwd ) / e2e_tests/provider_cfg/$1 /config.toml $CONFIG_PATH
67
69
if [ " $PROVIDER_NAME " = " all" ]; then
68
70
FEATURES=" --features=all-providers"
69
71
else
@@ -94,8 +96,13 @@ if [ "$PROVIDER_NAME" = "tpm" ] || [ "$PROVIDER_NAME" = "all" ]; then
94
96
fi
95
97
96
98
if [ " $PROVIDER_NAME " = " pkcs11" ] || [ " $PROVIDER_NAME " = " all" ]; then
97
- # Find and append the slot number at the end of the configuration file.
98
- e2e_tests/provider_cfg/pkcs11/find_slot_number.sh $CONFIG_PATH
99
+ pushd e2e_tests
100
+ # This command suppose that the slot created by the container will be the first one that appears
101
+ # when printing all the available slots.
102
+ SLOT_NUMBER=` softhsm2-util --show-slots | head -n2 | tail -n1 | cut -d " " -f 2`
103
+ # Find all TOML files in the directory (except Cargo.toml) and replace the commented slot number with the valid one
104
+ find . -name " *toml" -not -name " Cargo.toml" -exec sed -i " s/^# slot_number.*$/slot_number = $SLOT_NUMBER /" {} \;
105
+ popd
99
106
fi
100
107
101
108
echo " Build test"
@@ -128,6 +135,7 @@ pgrep -f target/debug/parsec >/dev/null
128
135
if [ " $PROVIDER_NAME " = " all" ]; then
129
136
echo " Execute all-providers tests"
130
137
RUST_BACKTRACE=1 cargo test --manifest-path ./e2e_tests/Cargo.toml all_providers
138
+ RUST_BACKTRACE=1 cargo test --manifest-path ./e2e_tests/Cargo.toml config
131
139
else
132
140
# Per provider tests
133
141
echo " Execute normal tests"
0 commit comments