Skip to content

instrument function mock stub for ~lib functions #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions instrumentation/MockInstrumentationWalker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ uint32_t MockInstrumentationWalker::mockWalk() noexcept {
return 1U; // failed
} else {
wasm::ModuleUtils::iterDefinedFunctions(*module, [this](wasm::Function *const func) noexcept {
if (!std::regex_match(func->name.str.begin(), func->name.str.end(), functionFilter)) {
walkFunctionInModule(func, this->module);
}
walkFunctionInModule(func, this->module);
});
return 0U;
}
Expand Down
2 changes: 0 additions & 2 deletions instrumentation/MockInstrumentationWalker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <regex>
#include <string_view>
#include <utility>
#include <vector>
Expand Down Expand Up @@ -139,7 +138,6 @@ class MockInstrumentationWalker final : public wasm::PostWalker<MockInstrumentat
private:
wasm::Module *const module; ///< working module
const std::string checkMock; ///< mock check string
const std::regex functionFilter = std::regex("~lib/.+");
wasm::Builder moduleBuilder; ///< module builder
uint32_t expectIndex = 0U; ///< expectation index, auto increase
wasm::ExpressionStack expressionStack;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"build": "node scripts/build_instrumentation.js && tsc --build ./transform/tsconfig.json && tsc --build ./src/tsconfig.json",
"test:as": "node bin/as-test.js",
"test:ts": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
"test:cpp": "cmake -B build -S . && cmake --build build --target wasm-instrumentation-test wasm-opt && build/bin/wasm-instrumentation-test",
"test:cpp": "cmake -B build -S . && cmake --build build --parallel 4 --target wasm-instrumentation-test wasm-opt && build/bin/wasm-instrumentation-test",
"test": "npm run test:as && npm run test:ts && npm run test:cpp",
"lint": "eslint src assembly tests/ts/test --max-warnings=0 && prettier -c .",
"lint:fix": "eslint src assembly --fix && prettier --write .",
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_instrumentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function initEmscripten() {
initEmscripten();

execSync("emcmake cmake -B build_wasm -S .", { encoding: "utf8", stdio: "inherit", env });
execSync("cmake --build build_wasm --target wasm-instrumentation", {
execSync("cmake --build build_wasm --parallel 4 --target wasm-instrumentation", {
encoding: "utf8",
stdio: "inherit",
env,
Expand Down