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

skip secure enclave signing tests when SKIP_SECURE_ENCLAVE_TESTS is set #1656

Merged
merged 2 commits into from
Mar 19, 2024
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
9 changes: 7 additions & 2 deletions cmd/launcher/secure_enclave_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ import (
)

const (
testWrappedEnvVarKey = "SECURE_ENCLAVE_TEST_WRAPPED"
macOsAppResourceDir = "../../ee/secureenclavesigner/test_app_resources"
testWrappedEnvVarKey = "SECURE_ENCLAVE_TEST_WRAPPED"
testSkipSecureEnclaveTestingEnvVarKey = "SKIP_SECURE_ENCLAVE_TESTS"
macOsAppResourceDir = "../../ee/secureenclavesigner/test_app_resources"
)

// TestSecureEnclaveTestRunner creates a MacOS app with the binary of this packages tests, then signs the app with entitlements and runs the tests.
Expand All @@ -37,6 +38,10 @@ func TestSecureEnclaveTestRunner(t *testing.T) {
t.Skipf("\nskipping because %s env var was not empty, this is the execution of the codesigned app with entitlements", testWrappedEnvVarKey)
}

if os.Getenv(testSkipSecureEnclaveTestingEnvVarKey) != "" {
t.Skipf("\nskipping because %s env var was set", testSkipSecureEnclaveTestingEnvVarKey)
}

t.Log("\nexecuting wrapped tests with codesigned app and entitlements")

// set up app bundle
Expand Down
9 changes: 7 additions & 2 deletions ee/secureenclavesigner/secureenclavesigner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import (
)

const (
testWrappedEnvVarKey = "SECURE_ENCLAVE_TEST_WRAPPED"
macOsAppResourceDir = "./test_app_resources"
testWrappedEnvVarKey = "SECURE_ENCLAVE_TEST_WRAPPED"
testSkipSecureEnclaveTestingEnvVarKey = "SKIP_SECURE_ENCLAVE_TESTS"
macOsAppResourceDir = "./test_app_resources"
)

func WithBinaryPath(p string) opt {
Expand All @@ -38,6 +39,10 @@ func TestSecureEnclaveSigner(t *testing.T) {
t.Skipf("\nskipping because %s env var was not empty, this is being run in a CI environment without access to secure enclave", testWrappedEnvVarKey)
}

if os.Getenv(testSkipSecureEnclaveTestingEnvVarKey) != "" {
t.Skipf("\nskipping because %s env var was set", testSkipSecureEnclaveTestingEnvVarKey)
}

// put the root dir somewhere else if you want to persist the signed macos app bundle
// should build this into make at some point
rootDir := "/tmp/secure_enclave_test"
Expand Down
5 changes: 5 additions & 0 deletions ee/secureenclavesigner/test_app_resources/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ In order to succesfully sign the app with entitlements, there are a few steps th
2. Add you device to the developer account using the "Provisioning UDID" found at Desktop Menu Applie Icon> About This Mac > More Info > System Report https://developer.apple.com/account/resources/devices/list
3. Create a provisioing profile that includes the device https://developer.apple.com/account/resources/profiles/list ... should probably include all devices on the team and be updated in the repo
4. Replace the `embedded.provisionprofile` file with the new profile

## Skipping Tests

- To skip these tests (e.g. while running tests on a machine which is not included in the provisioning profile), you can set the `SKIP_SECURE_ENCLAVE_TESTS` environment variable to any non-empty value
- `SKIP_SECURE_ENCLAVE_TESTS=y make test`
Loading