Skip to content
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

Update to latest cpp #615

Merged
merged 6 commits into from
Mar 14, 2022
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: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FAASM_VERSION=0.8.2
FAASM_CLI_IMAGE=faasm/cli:0.8.2

CPP_VERSION=0.1.4
CPP_CLI_IMAGE=faasm/cpp-sysroot:0.1.4
CPP_VERSION=0.1.5
CPP_CLI_IMAGE=faasm/cpp-sysroot:0.1.5

PYTHON_VERSION=0.1.0
PYTHON_CLI_IMAGE=faasm/cpython:0.1.0
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
container:
image: faasm/cpp-sysroot:0.1.4
image: faasm/cpp-sysroot:0.1.5
defaults:
run:
working-directory: /__w/faasm/faasm/clients/cpp
Expand Down Expand Up @@ -294,16 +294,16 @@ jobs:
run: docker-compose run -T python inv func func.upload func.uploadpy hello
# Function invocation
- name: "Invoke cpp function"
run: docker-compose run -T cpp inv func.invoke --host=nginx demo hello | tee output_1.log
run: docker-compose run -T cpp inv func.invoke demo hello | tee output_1.log
- name: "Invoke python hello function"
run: docker-compose run -T python inv func.invoke --host=nginx python hello
# Re-invocation of same function with different code after flush
- name: "Flush workers"
run: docker-compose run -T cpp inv func.flush --host=nginx
run: docker-compose run -T cpp inv func.flush
- name: "Build echo function and upload in place of hello function"
run: ./deploy/local/replace_hello_with_echo.sh
- name: "Invoke cpp function"
run: docker-compose run -T cpp inv func.invoke --host=nginx demo hello | tee output_2.log
run: docker-compose run -T cpp inv func.invoke demo hello | tee output_2.log
- name: "Check both outputs are different"
run: (cmp output_1.log output_2.log && exit 1 || exit 0)
# Print logs and finish
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ inv func demo hello
inv func.upload demo hello

# Invoke the function
inv func.invoke --host=nginx demo hello
inv func.invoke demo hello
```

## Acknowledgements
Expand Down
4 changes: 2 additions & 2 deletions src/wavm/faasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ WAVM_DEFINE_INTRINSIC_FUNCTION(env,
__faasm_lock_state_global,
I32 keyPtr)
{
auto kv = getStateKV(keyPtr, 0);
auto kv = getStateKV(keyPtr);
SPDLOG_DEBUG("S - lock_state_global - {}", kv->key);

kv->lockGlobal();
Expand All @@ -103,7 +103,7 @@ WAVM_DEFINE_INTRINSIC_FUNCTION(env,
__faasm_unlock_state_global,
I32 keyPtr)
{
auto kv = getStateKV(keyPtr, 0);
auto kv = getStateKV(keyPtr);
SPDLOG_DEBUG("S - unlock_state_global - {}", kv->key);

kv->unlockGlobal();
Expand Down
21 changes: 3 additions & 18 deletions tests/test/faaslet/test_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,8 @@ class StateFuncTestFixture : public FunctionExecTestFixture
}
};

TEST_CASE_METHOD(FunctionExecTestFixture,
"Test repeat invocation with state",
"[state]")
TEST_CASE_METHOD(FunctionExecTestFixture, "Test state counter", "[state]")
{
// Set up the function call
faabric::Message call = faabric::util::messageFactory("demo", "increment");

auto fac = std::make_shared<faaslet::FaasletFactory>();
Expand All @@ -63,20 +60,8 @@ TEST_CASE_METHOD(FunctionExecTestFixture,
faabric::scheduler::Scheduler& sch = faabric::scheduler::getScheduler();
sch.callFunction(call);

// Check result
faabric::Message resultA = sch.getFunctionResult(call.id(), 1);
REQUIRE(resultA.returnvalue() == 0);
REQUIRE(resultA.outputdata() == "Counter: 001");

// Call the function a second time, the state should have been incremented
call.set_id(0);
faabric::util::setMessageId(call);

sch.callFunction(call);

faabric::Message resultB = sch.getFunctionResult(call.id(), 1);
REQUIRE(resultB.returnvalue() == 0);
REQUIRE(resultB.outputdata() == "Counter: 002");
faabric::Message result = sch.getFunctionResult(call.id(), 1);
REQUIRE(result.returnvalue() == 0);

m.shutdown();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test/wasm/test_openmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ TEST_CASE_METHOD(OpenMPTestFixture,
"Test OpenMP Pi calculation",
"[wasm][openmp]")
{
doOmpTestLocal("mt_pi");
doOmpTestLocal("pi_faasm");
}

TEST_CASE_METHOD(OpenMPTestFixture,
Expand Down