forked from wasmerio/wasmer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b145d71
commit 71176cc
Showing
6 changed files
with
93 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// This header file is used only for test purposes! It is used by unit | ||
// test inside the `src/` directory for the moment. | ||
|
||
#ifndef TEST_WASM | ||
#define TEST_WASM | ||
|
||
#include "../wasm.h" | ||
#include "../wasmer_wasm.h" | ||
#include <stdio.h> | ||
#include <string.h> | ||
|
||
wasm_engine_t *wasm_engine_new() { | ||
wasm_config_t *config = wasm_config_new(); | ||
|
||
char *wasmer_test_compiler = getenv("TEST"); | ||
char *wasmer_test_engine; | ||
|
||
strtok_r(wasmer_test_compiler, "-", &wasmer_test_engine); | ||
printf("Using compiler: %s, engine: %s\n", wasmer_test_compiler, | ||
wasmer_test_engine); | ||
if (strcmp(wasmer_test_compiler, "cranelift") == 0) { | ||
assert(wasmer_is_compiler_available(CRANELIFT)); | ||
wasm_config_set_compiler(config, CRANELIFT); | ||
} else if (strcmp(wasmer_test_compiler, "llvm") == 0) { | ||
assert(wasmer_is_compiler_available(LLVM)); | ||
wasm_config_set_compiler(config, LLVM); | ||
} else if (strcmp(wasmer_test_compiler, "singlepass") == 0) { | ||
assert(wasmer_is_compiler_available(SINGLEPASS)); | ||
wasm_config_set_compiler(config, SINGLEPASS); | ||
} else if (wasmer_test_compiler) { | ||
printf("Compiler %s not recognized\n", wasmer_test_compiler); | ||
abort(); | ||
} | ||
if (strcmp(wasmer_test_engine, "jit") == 0) { | ||
assert(wasmer_is_engine_available(JIT)); | ||
wasm_config_set_engine(config, JIT); | ||
} else if (strcmp(wasmer_test_engine, "native") == 0) { | ||
assert(wasmer_is_engine_available(NATIVE)); | ||
wasm_config_set_engine(config, NATIVE); | ||
} else if (wasmer_test_engine) { | ||
printf("Engine %s not recognized\n", wasmer_test_engine); | ||
abort(); | ||
} | ||
|
||
wasm_engine_t *engine = wasm_engine_new_with_config(config); | ||
return engine; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters