Skip to content

Commit 5faf116

Browse files
committed
Simplify paths in 2 tests
PiperOrigin-RevId: 302549672 Change-Id: I281215da6add83bc1338f93613cad4e7efc93d61
1 parent b2964d4 commit 5faf116

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

asylo/test/misc/BUILD

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,7 @@ sgx_enclave_test(
650650
enclaves = {"enclave": ":die.so"},
651651
test_args = [
652652
"--enclave_path='{enclave}'",
653+
"--loader_path=$(rootpath :double_die_host_bin)",
653654
],
654655
deps = [
655656
"//asylo:enclave_client",
@@ -691,6 +692,7 @@ enclave_test(
691692
enclaves = {"enclave": ":exception.so"},
692693
test_args = [
693694
"--enclave_path='{enclave}'",
695+
"--loader_path=$(rootpath :exception_app_host_bin)",
694696
],
695697
deps = [
696698
":exception",
@@ -701,7 +703,6 @@ enclave_test(
701703
"//asylo/test/util:test_main",
702704
"//asylo/util:logging",
703705
"//asylo/util:status",
704-
"@bazel_tools//tools/cpp/runfiles",
705706
"@com_google_absl//absl/flags:flag",
706707
"@com_google_absl//absl/memory",
707708
"@com_google_absl//absl/strings",

asylo/test/misc/die_test.cc

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,19 @@
2020

2121
#include <gtest/gtest.h>
2222
#include "absl/flags/flag.h"
23-
#include "tools/cpp/runfiles/runfiles.h"
2423
#include "asylo/test/util/enclave_test.h"
2524
#include "asylo/test/util/exec_tester.h"
2625

27-
using bazel::tools::cpp::runfiles::Runfiles;
26+
ABSL_FLAG(std::string, loader_path, "", "Path to enclave loader");
27+
2828

2929
namespace asylo {
3030
namespace {
3131

3232
class DieTest : public ::testing::Test {
3333
public:
3434
void SetUp() override {
35-
std::string error;
36-
std::unique_ptr<Runfiles> runfiles(Runfiles::CreateForTest(&error));
37-
ASSERT_NE(runfiles, nullptr) << error;
38-
39-
app_ = runfiles->Rlocation(
40-
"com_google_asylo/asylo/test/misc/double_die_host_bin");
35+
app_ = absl::GetFlag(FLAGS_loader_path);
4136
}
4237

4338
protected:

asylo/test/misc/exception_test.cc

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@
2222
#include <gtest/gtest.h>
2323
#include "absl/flags/flag.h"
2424
#include "absl/strings/string_view.h"
25-
#include "tools/cpp/runfiles/runfiles.h"
2625
#include "asylo/test/util/enclave_test.h" // enclave_path
2726
#include "asylo/test/util/exec_tester.h"
2827

29-
using bazel::tools::cpp::runfiles::Runfiles;
28+
ABSL_FLAG(std::string, loader_path, "", "Path to loader binary");
3029

3130
namespace asylo {
3231
namespace {
@@ -35,14 +34,9 @@ class ExceptionTest : public ::testing::Test {
3534
protected:
3635
// Return the status of the test subprocess.
3736
void RunTest(const std::string &input, int *status) {
38-
std::string error;
39-
std::unique_ptr<Runfiles> runfiles(Runfiles::CreateForTest(&error));
40-
ASSERT_NE(runfiles, nullptr) << error;
41-
42-
std::string path = runfiles->Rlocation(
43-
"com_google_asylo/asylo/test/misc/exception_app_host_bin");
4437
experimental::ExecTester test({
45-
path, absl::GetFlag(FLAGS_enclave_path), input});
38+
absl::GetFlag(FLAGS_loader_path),
39+
absl::GetFlag(FLAGS_enclave_path), input});
4640
ASSERT_TRUE(test.Run("", status));
4741
}
4842
};

0 commit comments

Comments
 (0)