trusty:cast-test: only run keybox test when using matching fake keybox

The test relies on the fake keybox implementation and will fail
otherwise.  Therefore disable the test is not using the fake keybox.

Bug: 323831890
Test: build.py
Change-Id: Ic727406e80075cec4ba29f4673bd7517ef9c87b5
diff --git a/app/test-app/main.cc b/app/test-app/main.cc
index 994c00c..bf2f0e5 100644
--- a/app/test-app/main.cc
+++ b/app/test-app/main.cc
@@ -189,8 +189,8 @@
         0x7b, 0xde, 0x9e, 0xb2};
 
 /* The following function is solely for the purpose of testing. It "wraps" a key
- * such that it can be unwrapped by the sample keybox implementation in Trusty
- * As warned therein:
+ * such that it can be unwrapped by the sample keybox implementation in Trusty,
+ * used when WITH_FAKE_KEYBOX is set. As warned therein:
  *
  * THIS DOES NOT PROVIDE ANY SECURITY
  *
@@ -259,7 +259,13 @@
     state->srv.clear();
 }
 
-TEST_F(CastAuthTest, ProvisionAndSignHash) {
+#if defined(WITH_FAKE_KEYBOX)
+#define FAKE_KEYBOX_ONLY_TEST(name) name
+#else
+#define FAKE_KEYBOX_ONLY_TEST(name) DISABLED_##name
+#endif
+
+TEST_F(CastAuthTest, FAKE_KEYBOX_ONLY_TEST(ProvisionAndSignHash)) {
     std::vector<uint8_t> wrapped_keybox(test_pkcs1_der.size() + 1);
     size_t wrapped_keybox_len;
     keybox_wrap_for_test(test_pkcs1_der.data(), test_pkcs1_der.size(),
diff --git a/app/test-app/rules.mk b/app/test-app/rules.mk
index 69807a2..73935ee 100644
--- a/app/test-app/rules.mk
+++ b/app/test-app/rules.mk
@@ -23,4 +23,8 @@
 MODULE_LIBRARY_DEPS += \
 	trusty/user/app/cast-auth/aidl \
 
+ifeq (true,$(call TOBOOL,$(WITH_FAKE_KEYBOX)))
+MODULE_DEFINES += WITH_FAKE_KEYBOX
+endif
+
 include make/trusted_app.mk