Skip to content

Conversation

@csegarragonz
Copy link
Collaborator

@csegarragonz csegarragonz commented Feb 15, 2022

In this PR I change the way we indicate that we want to run a function with SGX. Even though it is not semantically correct, the environment variable indicating what WASM_VM we use takes now three possible values: wavm (default), wamr, and sgx.

This means that wen using the CLI we don't need to pass any extra parameters, just set the variable beforehand:

export WASM_VM="sgx"

# Codegen and run function inside enclave
inv codegen demo hello
inv run demo hello

export WASM_VM="wavm"

# Codegen and run function with WAVM
inv codegen demo hello
inv run demo hello

This also means that we can get rid of the references to SGX in the faabric message (faasm/faabric#229).

]

WAMR_WHITELISTED_FUNCS = [
WAMR_ALLOWED_FUNCS = [
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of unrelated, but following our master->main re-factor, I thought I would also change this whilst I was amending this file (I don't think we use whitelist/blacklist anywhere else other than sgx code which will get re-factored now anyway).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, yeah let's keep chipping away at this.

env = copy(environ)
env.update(
{
"WASM_VM": "wamr" if wamr else "wavm",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't update the environment, therefore we inherit whatever we'd set there.

Copy link
Collaborator

@Shillaker Shillaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, much cleaner. Just a small comment about checking a test.

}
SECTION("SGX codegen")
{
conf.wasmVm = "sgx";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you double check that there's a FaasmConfigTestFixture somewhere in the class hierarchy for this test? We just want to make sure that the config is reset at the end of each test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an S3TestFixture that resets the config 👍

@csegarragonz csegarragonz merged commit af0dd36 into main Feb 16, 2022
@csegarragonz csegarragonz deleted the env-variable branch February 16, 2022 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants