f407419d0a
This relands https://dart-review.googlesource.com/c/sdk/+/205633 but without renaming TARGET_OS_IPHONE to DART_TARGET_OS_IPHONE. It also changes uses of TARGET_OS_IOS to DART_TARGET_OS_MACOS_IOS to be consistent with the rest of the VM. TargetConditionals.h for XCode 13 defines several TARGET_OS_* preprocessor symbols that confuse the Dart build. There is probably a more targeted fix for this, but renaming the symbols that Dart uses will also prevent this problem if more symbols are added to the platform headers in the future. See: https://github.com/dart-lang/sdk/issues/46499 TEST=It builds. Change-Id: Ie775c19dd23cfdf5f65e5ebc6ee4ec3a561676fa Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205860 Commit-Queue: Zach Anderson <zra@google.com> Reviewed-by: Alexander Aprelev <aam@google.com>
54 lines
1.8 KiB
C++
54 lines
1.8 KiB
C++
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#if defined(DART_HOST_OS_MACOS)
|
|
#include "bin/platform.h"
|
|
#include "vm/unit_test.h"
|
|
|
|
namespace dart {
|
|
|
|
TEST_CASE(Platform_ExtractsOSVersionFromString) {
|
|
char str[] =
|
|
"some overheads\n<key>ProductVersion</key>\nsome bytes<string>Fake "
|
|
"version</string>";
|
|
char* result = bin::ExtractsOSVersionFromString(str);
|
|
EXPECT(result != NULL);
|
|
EXPECT_STREQ("Fake version", result);
|
|
|
|
EXPECT(bin::ExtractsOSVersionFromString("<key>ProductVersion</key>") == NULL);
|
|
|
|
// Incomplete file
|
|
EXPECT(bin::ExtractsOSVersionFromString(
|
|
"<key>ProductVersion</key><string>Fake version</string") != NULL);
|
|
|
|
// A copy of actual SystemVersion.plist on mac.
|
|
str =
|
|
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
|
"<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" "
|
|
"\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
|
|
"<plist version=\"1.0\">\n"
|
|
"<dict>\n"
|
|
" <key>ProductBuildVersion</key>\n"
|
|
" <string>19E287</string>\n"
|
|
" <key>ProductCopyright</key>\n"
|
|
" <string>1983-2020 Apple Inc.</string>\n"
|
|
" <key>ProductName</key>\n"
|
|
" <string>Mac OS X</string>\n"
|
|
" <key>ProductUserVisibleVersion</key>\n"
|
|
" <string>10.15.4</string>\n"
|
|
" <key>ProductVersion</key>\n"
|
|
" <string>10.15.4</string>\n"
|
|
" <key>iOSSupportVersion</key>\n"
|
|
" <string>13.4</string>\n"
|
|
"</dict>\n"
|
|
"</plist>"
|
|
|
|
result = bin::ExtractsOSVersionFromString(str);
|
|
EXPECT(result != NULL);
|
|
EXPECT_STREQ("10.15.4", result);
|
|
}
|
|
|
|
} // namespace dart
|
|
#endif // defined(DART_HOST_OS_MACOS)
|