Skip to content

Commit 220bb48

Browse files
committed
test(tvos): report native secure-store failures without credential output
1 parent f04ecaa commit 220bb48

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

‎tests/platform/TvOSRuntimeSmoke.mm‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <cstdio>
1515

1616
#import <AVFoundation/AVFoundation.h>
17+
#import <Security/Security.h>
1718
extern "C" {
1819
#include <mpv/client.h>
1920
}
@@ -99,8 +100,21 @@ int secureStoreSmoke(int argc, char **argv)
99100
const bool removed = Spool::CredentialStore::load(account).isEmpty();
100101
QTemporaryFile data(QDir(Spool::persistentDataRoot()).filePath(QStringLiteral("smoke-XXXXXX")));
101102
const bool writable = data.open() && data.write("sandbox") == 7 && data.flush();
102-
if (!saved || !loaded || !removed || !writable)
103+
if (!saved || !loaded || !removed || !writable) {
104+
std::fprintf(stderr, "tvOS credentials smoke: saved=%d loaded=%d removed=%d writable=%d\n",
105+
saved, loaded, removed, writable);
106+
// Read the actual native status without logging any account/value.
107+
NSDictionary *query = @{ (__bridge id)kSecClass: (__bridge id)kSecClassGenericPassword,
108+
(__bridge id)kSecAttrService: @SPOOL_APPLE_CREDENTIAL_SERVICE,
109+
(__bridge id)kSecAttrAccount: [NSString stringWithUTF8String:account.toUtf8().constData()],
110+
(__bridge id)kSecReturnData: @YES };
111+
CFTypeRef result = nullptr;
112+
const OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, &result);
113+
if (result)
114+
CFRelease(result);
115+
std::fprintf(stderr, "tvOS credentials smoke: nativeStatus=%d\n", int(status));
103116
return 1;
117+
}
104118
std::fprintf(stderr, "tvOS credentials smoke: Keychain roundtrip and sandbox file persistence passed\n");
105119
return 0;
106120
}

0 commit comments

Comments
 (0)