Skip to content

Commit e2b1042

Browse files
Merge pull request #124 from ElrondNetwork/mandos-libwasmer
Fix reference to libwasmer (referenced by mandos-test)
2 parents 0c196d1 + a7a85c1 commit e2b1042

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

erdpy/dependencies/modules.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,17 +159,17 @@ def _post_install(self, tag: str):
159159
self.make_binary_symlink_in_parent_folder(tag, 'test', 'mandos-test')
160160
self.copy_libwasmer_in_parent_directory(tag)
161161

162-
def build_binary(self, tag, binary_name):
162+
def build_binary(self, tag: str, binary_name: str):
163163
source_folder = self.binary_source_folder(tag, binary_name)
164164
golang = dependencies.get_module_by_key("golang")
165165
golang_env = golang.get_env()
166166
myprocess.run_process(['go', 'build'], cwd=source_folder, env=golang_env)
167167

168-
def binary_source_folder(self, tag, binary_name):
168+
def binary_source_folder(self, tag: str, binary_name: str):
169169
directory = self.get_source_directory(tag)
170170
return directory / 'cmd' / binary_name
171171

172-
def make_binary_symlink_in_parent_folder(self, tag, binary_name, symlink_name):
172+
def make_binary_symlink_in_parent_folder(self, tag: str, binary_name: str, symlink_name: str):
173173
source_folder = self.binary_source_folder(tag, binary_name)
174174
binary = source_folder / binary_name
175175

@@ -179,16 +179,19 @@ def make_binary_symlink_in_parent_folder(self, tag, binary_name, symlink_name):
179179
symlink.unlink(missing_ok=True)
180180
symlink.symlink_to(binary)
181181

182-
def copy_libwasmer_in_parent_directory(self, tag):
182+
def copy_libwasmer_in_parent_directory(self, tag: str):
183183
libwasmer_directory = self.get_source_directory(tag) / 'wasmer'
184+
cmd_test_directory = self.get_source_directory(tag) / 'cmd' / 'test'
184185
parent_directory = self.get_parent_directory()
185186
for f in libwasmer_directory.iterdir():
186187
if f.suffix in ['.dylib', '.so', '.dll']:
188+
# Copy the dynamic library near the "mandos-test" symlink
187189
shutil.copy(f, parent_directory)
190+
# Though, also copy the dynamic library near the target executable (seems to be necessary on MacOS)
191+
shutil.copy(f, cmd_test_directory)
188192

189-
def get_env(self):
190-
return {
191-
}
193+
def get_env(self) -> Dict[str, str]:
194+
return dict()
192195

193196

194197
class GolangModule(StandaloneModule):

erdpy/tests/test_cli_contracts.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
source "./shared.sh"
44

55
testTrivialCommands() {
6+
echo "testTrivialCommands"
67
${ERDPY} contract templates
78
}
89

910
testCreateContracts() {
11+
echo "testCreateContracts"
1012
${ERDPY} contract new --template ultimate-answer --directory ${SANDBOX} myanswer-c || return 1
1113
${ERDPY} contract new --template simple-counter --directory ${SANDBOX} mycounter-c || return 1
1214
${ERDPY} contract new --template erc20-c --directory ${SANDBOX} myerc20-c || return 1
@@ -20,6 +22,7 @@ testCreateContracts() {
2022
}
2123

2224
testBuildContracts() {
25+
echo "testBuildContracts"
2326
${ERDPY} contract build ${SANDBOX}/myanswer-c || return 1
2427
assertFileExists ${SANDBOX}/myanswer-c/output/answer.wasm || return 1
2528

@@ -55,13 +58,15 @@ testBuildContracts() {
5558
}
5659

5760
testRunMandos() {
61+
echo "testRunMandos"
5862
${ERDPY} --verbose contract test --directory="mandos" ${SANDBOX}/myadder-rs || return 1
5963
${ERDPY} --verbose contract test --directory="mandos" ${SANDBOX}/mybubbles-rs || return 1
6064
${ERDPY} --verbose contract test --directory="mandos" ${SANDBOX}/mylottery-rs || return 1
6165
${ERDPY} --verbose contract test --directory="mandos" ${SANDBOX}/myfunding-rs || return 1
6266
}
6367

6468
testWasmName() {
69+
echo "testWasmName"
6570
${ERDPY} contract clean ${SANDBOX}/myanswer-c || return 1
6671
assertFileDoesNotExist ${SANDBOX}/myanswer-c/output/answer-2.wasm || return 1
6772
${ERDPY} contract build ${SANDBOX}/myanswer-c --wasm-name answer-2 || return 1
@@ -75,6 +80,7 @@ testWasmName() {
7580
}
7681

7782
testCleanContracts() {
83+
echo "testCleanContracts"
7884
assertFileExists ${SANDBOX}/myanswer-c/output/answer.wasm || return 1
7985
${ERDPY} contract clean ${SANDBOX}/myanswer-c || return 1
8086
assertFileDoesNotExist ${SANDBOX}/myanswer-c/output/answer.wasm || return 1

0 commit comments

Comments
 (0)