[benchmark] Add iOS benchmark runner
This commit is contained in:
@@ -26,6 +26,18 @@ target_include_directories(
|
||||
|
||||
include(${PROJECT_SOURCE_DIR}/vendor/benchmark.cmake)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL iOS)
|
||||
set_target_properties(mbgl-vendor-benchmark PROPERTIES XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "${IOS_DEPLOYMENT_TARGET}")
|
||||
set_target_properties(mbgl-vendor-benchmark PROPERTIES XCODE_ATTRIBUTE_ENABLE_BITCODE "YES")
|
||||
set_target_properties(mbgl-vendor-benchmark PROPERTIES XCODE_ATTRIBUTE_BITCODE_GENERATION_MODE bitcode)
|
||||
set_target_properties(mbgl-vendor-benchmark PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH $<$<CONFIG:Debug>:YES>)
|
||||
|
||||
set_target_properties(mbgl-benchmark PROPERTIES XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "${IOS_DEPLOYMENT_TARGET}")
|
||||
set_target_properties(mbgl-benchmark PROPERTIES XCODE_ATTRIBUTE_ENABLE_BITCODE "YES")
|
||||
set_target_properties(mbgl-benchmark PROPERTIES XCODE_ATTRIBUTE_BITCODE_GENERATION_MODE bitcode)
|
||||
set_target_properties(mbgl-benchmark PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH $<$<CONFIG:Debug>:YES>)
|
||||
endif()
|
||||
|
||||
# Needed for testing private classes
|
||||
get_target_property(MBGL_CORE_PRIVATE_LIBRARIES mbgl-core LINK_LIBRARIES)
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BenchmarkAppTests</key>
|
||||
<dict>
|
||||
<key>BlueprintName</key>
|
||||
<string>BenchmarkAppTests</string>
|
||||
<key>BundleIdentifiersForCrashReportEmphasis</key>
|
||||
<array>
|
||||
<string>com.mapbox.BenchmarkApp</string>
|
||||
<string>com.mapbox.BenchmarkAppTests</string>
|
||||
</array>
|
||||
<key>CommandLineArguments</key>
|
||||
<array/>
|
||||
<key>DependentProductPaths</key>
|
||||
<array>
|
||||
<string>__TESTROOT__/Debug-iphoneos/BenchmarkApp.app</string>
|
||||
<string>__TESTROOT__/Debug-iphoneos/BenchmarkApp.app/PlugIns/BenchmarkAppTests.xctest</string>
|
||||
</array>
|
||||
<key>EnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>OS_ACTIVITY_DT_MODE</key>
|
||||
<string>YES</string>
|
||||
<key>SQLITE_ENABLE_THREAD_ASSERTIONS</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
<key>IsAppHostedTestBundle</key>
|
||||
<true/>
|
||||
<key>ProductModuleName</key>
|
||||
<string>BenchmarkAppTests</string>
|
||||
<key>RunOrder</key>
|
||||
<integer>0</integer>
|
||||
<key>SystemAttachmentLifetime</key>
|
||||
<string>deleteOnSuccess</string>
|
||||
<key>TestBundlePath</key>
|
||||
<string>__TESTHOST__/PlugIns/BenchmarkAppTests.xctest</string>
|
||||
<key>TestHostBundleIdentifier</key>
|
||||
<string>com.mapbox.BenchmarkApp</string>
|
||||
<key>TestHostPath</key>
|
||||
<string>__TESTROOT__/Debug-iphoneos/BenchmarkApp.app</string>
|
||||
<key>TestLanguage</key>
|
||||
<string></string>
|
||||
<key>TestRegion</key>
|
||||
<string></string>
|
||||
<key>TestingEnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>DYLD_FALLBACK_FRAMEWORK_PATH</key>
|
||||
<string></string>
|
||||
<key>DYLD_INSERT_LIBRARIES</key>
|
||||
<string>__PLATFORMS__/iPhoneOS.platform/Developer/usr/lib/libXCTestBundleInject.dylib</string>
|
||||
<key>XCInjectBundleInto</key>
|
||||
<string>unused</string>
|
||||
</dict>
|
||||
<key>ToolchainsSettingValue</key>
|
||||
<array/>
|
||||
<key>UITargetAppCommandLineArguments</key>
|
||||
<array/>
|
||||
<key>UserAttachmentLifetime</key>
|
||||
<string>deleteOnSuccess</string>
|
||||
</dict>
|
||||
<key>__xctestrun_metadata__</key>
|
||||
<dict>
|
||||
<key>FormatVersion</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BenchmarkAppTests</key>
|
||||
<dict>
|
||||
<key>BlueprintName</key>
|
||||
<string>BenchmarkAppTests</string>
|
||||
<key>BundleIdentifiersForCrashReportEmphasis</key>
|
||||
<array>
|
||||
<string>com.mapbox.BenchmarkApp</string>
|
||||
<string>com.mapbox.BenchmarkAppTests</string>
|
||||
</array>
|
||||
<key>CommandLineArguments</key>
|
||||
<array/>
|
||||
<key>DependentProductPaths</key>
|
||||
<array>
|
||||
<string>__TESTROOT__/Release-iphoneos/BenchmarkApp.app</string>
|
||||
<string>__TESTROOT__/Release-iphoneos/BenchmarkApp.app/PlugIns/BenchmarkAppTests.xctest</string>
|
||||
</array>
|
||||
<key>EnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>OS_ACTIVITY_DT_MODE</key>
|
||||
<string>YES</string>
|
||||
<key>SQLITE_ENABLE_THREAD_ASSERTIONS</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
<key>IsAppHostedTestBundle</key>
|
||||
<true/>
|
||||
<key>ProductModuleName</key>
|
||||
<string>BenchmarkAppTests</string>
|
||||
<key>RunOrder</key>
|
||||
<integer>0</integer>
|
||||
<key>SystemAttachmentLifetime</key>
|
||||
<string>deleteOnSuccess</string>
|
||||
<key>TestBundlePath</key>
|
||||
<string>__TESTHOST__/PlugIns/BenchmarkAppTests.xctest</string>
|
||||
<key>TestHostBundleIdentifier</key>
|
||||
<string>com.mapbox.BenchmarkApp</string>
|
||||
<key>TestHostPath</key>
|
||||
<string>__TESTROOT__/Release-iphoneos/BenchmarkApp.app</string>
|
||||
<key>TestLanguage</key>
|
||||
<string></string>
|
||||
<key>TestRegion</key>
|
||||
<string></string>
|
||||
<key>TestingEnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>DYLD_FALLBACK_FRAMEWORK_PATH</key>
|
||||
<string></string>
|
||||
<key>DYLD_INSERT_LIBRARIES</key>
|
||||
<string>__PLATFORMS__/iPhoneOS.platform/Developer/usr/lib/libXCTestBundleInject.dylib</string>
|
||||
<key>XCInjectBundleInto</key>
|
||||
<string>unused</string>
|
||||
</dict>
|
||||
<key>ToolchainsSettingValue</key>
|
||||
<array/>
|
||||
<key>UITargetAppCommandLineArguments</key>
|
||||
<array/>
|
||||
<key>UserAttachmentLifetime</key>
|
||||
<string>deleteOnSuccess</string>
|
||||
</dict>
|
||||
<key>__xctestrun_metadata__</key>
|
||||
<dict>
|
||||
<key>FormatVersion</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
62
benchmark/ios/Info.plist
Normal file
62
benchmark/ios/Info.plist
Normal file
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN""http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>BenchmarkApp</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.mapbox.BenchmarkApp</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>com.mapbox.BenchmarkApp</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleLongVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>com.mapbox.BenchmarkApp</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>MBGL</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>7877</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>© 2014–2020 Mapbox</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>fetch</string>
|
||||
<string>remote-notification</string>
|
||||
</array>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
7
benchmark/ios/README.md
Normal file
7
benchmark/ios/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# iOS BenchmarkRunner App
|
||||
|
||||
This is a blank single-view-controller iOS app, linked against to a C++ static libraries, plus a a simple unit xctest. We use CMake to create an Xcode-friendly out-of-source build system. In another word, the build system is maintained by `CMakeLists` file,instead of a configured `.xcodeproj` file.
|
||||
|
||||
This CMake project can build the executable BenchmarkApp which is linked to the static C++ library 'mbgl-benchmark'. CMakeLists.txt files are the only build configuration kept in source control. This is in contrast to committing the `.xcodeproj` directory which includes the backing XML, which is nonsensically hard to edit by hand.
|
||||
|
||||
The test instantiates ObjC object of class `IosTestRunner` from the app, the class will instantiates a C++ object from the linked library `mbgl-benchmark` and calls running benchmark function on it. It subsequently deletes the C++ object pointer. In the end, the test will check the existence of test report, which is a json file that attach to xctest result.
|
||||
16
benchmark/ios/codesigning/BenchmarkApp.app.xcent.template
Normal file
16
benchmark/ios/codesigning/BenchmarkApp.app.xcent.template
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>application-identifier</key>
|
||||
<string>$TEAM_ID.com.mapbox.BenchmarkApp</string>
|
||||
<key>com.apple.developer.team-identifier</key>
|
||||
<string>$TEAM_ID</string>
|
||||
<key>get-task-allow</key>
|
||||
<true/>
|
||||
<key>keychain-access-groups</key>
|
||||
<array>
|
||||
<string>$TEAM_ID.com.mapbox.BenchmarkApp</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>application-identifier</key>
|
||||
<string>$TEAM_ID.com.mapbox.BenchmarkAppTests</string>
|
||||
<key>com.apple.developer.team-identifier</key>
|
||||
<string>$TEAM_ID</string>
|
||||
<key>get-task-allow</key>
|
||||
<true/>
|
||||
<key>keychain-access-groups</key>
|
||||
<array>
|
||||
<string>$TEAM_ID.com.mapbox.BenchmarkAppTests</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>application-identifier</key>
|
||||
<string>$TEAM_ID.com.mapbox.BenchmarkAppTests</string>
|
||||
<key>com.apple.developer.team-identifier</key>
|
||||
<string>$TEAM_ID</string>
|
||||
<key>get-task-allow</key>
|
||||
<true/>
|
||||
<key>keychain-access-groups</key>
|
||||
<array>
|
||||
<string>$TEAM_ID.com.mapbox.BenchmarkAppTests</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
16
benchmark/ios/codesigning/XCTest.framework.xcent.template
Normal file
16
benchmark/ios/codesigning/XCTest.framework.xcent.template
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>application-identifier</key>
|
||||
<string>$TEAM_ID.com.mapbox.BenchmarkAppTests</string>
|
||||
<key>com.apple.developer.team-identifier</key>
|
||||
<string>$TEAM_ID</string>
|
||||
<key>get-task-allow</key>
|
||||
<true/>
|
||||
<key>keychain-access-groups</key>
|
||||
<array>
|
||||
<string>$TEAM_ID.com.mapbox.BenchmarkAppTests</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
8
benchmark/ios/codesigning/codesign_all.sh
Executable file
8
benchmark/ios/codesigning/codesign_all.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
codesign --force --sign $CODESIGNIDENTITY --entitlements ../codesigning/BenchmarkApp.app.xcent --timestamp=none ./Release-iphoneos/BenchmarkApp.app
|
||||
codesign --force --sign $CODESIGNIDENTITY --deep --preserve-metadata=identifier,entitlements,flags --timestamp=none ./Release-iphoneos/BenchmarkApp.app/Frameworks/libXCTestSwiftSupport.dylib
|
||||
codesign --force --sign $CODESIGNIDENTITY --deep --preserve-metadata=identifier,entitlements,flags --timestamp=none ./Release-iphoneos/BenchmarkApp.app/Frameworks/libXCTestBundleInject.dylib
|
||||
codesign --force --sign $CODESIGNIDENTITY --deep --preserve-metadata=identifier,entitlements,flags --timestamp=none ./Release-iphoneos/BenchmarkApp.app/Frameworks/XCTAutomationSupport.framework
|
||||
codesign --force --sign $CODESIGNIDENTITY --deep --preserve-metadata=identifier,entitlements,flags --timestamp=none ./Release-iphoneos/BenchmarkApp.app/Frameworks/XCTest.framework
|
||||
codesign --force --sign $CODESIGNIDENTITY --deep --entitlements ../codesigning/BenchmarkAppTests.xctest.xcent --timestamp=none ./Release-iphoneos/BenchmarkApp.app/PlugIns/BenchmarkAppTests.xctest
|
||||
40
benchmark/ios/codesigning/generate-entitlements.swift
Executable file
40
benchmark/ios/codesigning/generate-entitlements.swift
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/swift
|
||||
|
||||
/// Generates Entitlement files .xcent for codesigning, containing the correct team id
|
||||
import Swift
|
||||
import Foundation
|
||||
|
||||
let fileManager = FileManager.default
|
||||
|
||||
let contentsOfCurrentWorkingDirectory = try FileManager.default.contentsOfDirectory(at: URL(fileURLWithPath: "./codesigning/"), includingPropertiesForKeys: nil, options: [])
|
||||
|
||||
guard let rawTeamIdEnv = getenv("IOS_DEVELOPMENT_TEAM") else {
|
||||
print("Please add a IOS_DEVELOPMENT_TEAM environment variable.")
|
||||
exit(1)
|
||||
}
|
||||
|
||||
let teamId2 = String(utf8String: rawTeamIdEnv)
|
||||
|
||||
for file in contentsOfCurrentWorkingDirectory {
|
||||
if (file.pathExtension == "template") {
|
||||
var content = ""
|
||||
do {
|
||||
content = try String(contentsOf: file, encoding: .utf8)
|
||||
}
|
||||
catch {
|
||||
print("Error reading xcent file: \(error).")
|
||||
}
|
||||
|
||||
content = content.replacingOccurrences(of: "$TEAM_ID", with: teamId2!)
|
||||
|
||||
var targetFile = file
|
||||
targetFile.deletePathExtension()
|
||||
do {
|
||||
try content.write(to: targetFile, atomically: false, encoding: .utf8)
|
||||
print("Entitlement " + targetFile.absoluteString + " generated.")
|
||||
}
|
||||
catch {
|
||||
print("Error writing xcent file: \(error).")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>application-identifier</key>
|
||||
<string>$TEAM_ID.com.mapbox.BenchmarkAppTests</string>
|
||||
<key>com.apple.developer.team-identifier</key>
|
||||
<string>$TEAM_ID</string>
|
||||
<key>get-task-allow</key>
|
||||
<true/>
|
||||
<key>keychain-access-groups</key>
|
||||
<array>
|
||||
<string>$TEAM_ID.com.mapbox.BenchmarkAppTests</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
3
benchmark/ios/fastlane/Appfile
Normal file
3
benchmark/ios/fastlane/Appfile
Normal file
@@ -0,0 +1,3 @@
|
||||
app_identifier("com.mapbox.BenchmarkApp") # The bundle identifier of your app
|
||||
apple_id ENV['MAPBOX_APPLE_ID']
|
||||
team_id ENV['MAPBOX_APPLE_TEAM_ID'] # Developer Portal Team ID
|
||||
5
benchmark/ios/fastlane/Matchfile
Normal file
5
benchmark/ios/fastlane/Matchfile
Normal file
@@ -0,0 +1,5 @@
|
||||
git_url("git@github.com:mapbox/apple-certificates.git")
|
||||
type("development") # The default type, can be: appstore, adhoc, enterprise or development
|
||||
app_identifier(["com.mapbox.BenchmarkApp", "com.mapbox.BenchmarkAppTests"])
|
||||
username ENV['MAPBOX_APPLE_ID']
|
||||
keychain_name("fastlane_keychain")
|
||||
12
benchmark/ios/iosTestRunner.h
Normal file
12
benchmark/ios/iosTestRunner.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NSString *dataDir = @"benchmark-data";
|
||||
NSString *resultFilePath = @"benchmark/results.json";
|
||||
|
||||
__attribute__((visibility ("default")))
|
||||
@interface IosTestRunner : NSObject
|
||||
|
||||
- (NSString*) getResultPath;
|
||||
- (BOOL) getTestStatus;
|
||||
|
||||
@end
|
||||
34
benchmark/ios/ios_test_runner.cpp
Normal file
34
benchmark/ios/ios_test_runner.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#include <ios_test_runner.hpp>
|
||||
|
||||
#include <mbgl/benchmark.hpp>
|
||||
|
||||
#include <mbgl/util/logging.hpp>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
|
||||
#define EXPORT __attribute__((visibility("default")))
|
||||
|
||||
EXPORT
|
||||
bool TestRunner::startTest(const std::string& basePath) {
|
||||
std::vector<std::string> arguments = {"mbgl-benchmark-runner",
|
||||
"--benchmark_repetitions=3",
|
||||
"--benchmark_format=json",
|
||||
"--benchmark_out=" + basePath + "/benchmark/results.json"};
|
||||
std::vector<char*> argv;
|
||||
for (const auto& arg : arguments) {
|
||||
argv.push_back(const_cast<char*>(arg.data()));
|
||||
}
|
||||
argv.push_back(nullptr);
|
||||
|
||||
if (chdir(basePath.c_str())) {
|
||||
mbgl::Log::Error(mbgl::Event::General, "Failed to change the directory to " + basePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
mbgl::Log::Info(mbgl::Event::General, "Start BenchmarkRunner");
|
||||
int status = mbgl::runBenchmark(static_cast<uint32_t>(argv.size()), argv.data());
|
||||
mbgl::Log::Info(mbgl::Event::General, "BenchmarkRunner finished with status: '%d'", status);
|
||||
|
||||
return status == 0;
|
||||
}
|
||||
22
benchmark/ios/tests/Info.plist
Normal file
22
benchmark/ios/tests/Info.plist
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>BenchmarkAppTests</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.mapbox.BenchmarkAppTests</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>BenchmarkAppTests</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -265,4 +265,76 @@ if(MBGL_IOS_UNIT_TEST)
|
||||
set_target_properties(UnitTestsAppTests PROPERTIES XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
|
||||
endif()
|
||||
|
||||
if(MBGL_IOS_BENCHMARK)
|
||||
execute_process(COMMAND ditto ${PROJECT_SOURCE_DIR}/benchmark/fixtures ${CMAKE_CURRENT_BINARY_DIR}/benchmark-data/benchmark/fixtures)
|
||||
execute_process(
|
||||
COMMAND
|
||||
ditto ${PROJECT_SOURCE_DIR}/test/fixtures/api/assets/streets
|
||||
${CMAKE_CURRENT_BINARY_DIR}/benchmark-data/test/fixtures/api/assets/streets
|
||||
)
|
||||
|
||||
set(RESOURCES ${PROJECT_SOURCE_DIR}/platform/ios/test/common/Main.storyboard
|
||||
${PROJECT_SOURCE_DIR}/platform/ios/test/common/LaunchScreen.storyboard ${CMAKE_CURRENT_BINARY_DIR}/benchmark-data)
|
||||
|
||||
add_executable(
|
||||
BenchmarkApp
|
||||
${PROJECT_SOURCE_DIR}/platform/ios/test/common/ios_test_runner.hpp
|
||||
${PROJECT_SOURCE_DIR}/platform/ios/test/common/AppDelegate.h
|
||||
${PROJECT_SOURCE_DIR}/platform/ios/test/common/AppDelegate.m
|
||||
${PROJECT_SOURCE_DIR}/platform/ios/test/common/iosTestRunner.mm
|
||||
${PROJECT_SOURCE_DIR}/platform/ios/test/common/main.m
|
||||
${PROJECT_SOURCE_DIR}/benchmark/ios/ios_test_runner.cpp
|
||||
${PROJECT_SOURCE_DIR}/benchmark/ios/iosTestRunner.h
|
||||
${RESOURCES}
|
||||
)
|
||||
initialize_ios_target(BenchmarkApp)
|
||||
|
||||
target_include_directories(
|
||||
BenchmarkApp
|
||||
PUBLIC
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
${PROJECT_SOURCE_DIR}/platform/ios/test/common
|
||||
${PROJECT_SOURCE_DIR}/benchmark/include
|
||||
${PROJECT_SOURCE_DIR}/benchmark/ios
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
BenchmarkApp
|
||||
PRIVATE
|
||||
"-framework CoreGraphics"
|
||||
"-framework CoreLocation"
|
||||
"-framework Foundation"
|
||||
"-framework OpenGLES"
|
||||
"-framework QuartzCore"
|
||||
"-framework UIKit"
|
||||
mbgl-compiler-options
|
||||
-Wl,-force_load
|
||||
mbgl-benchmark
|
||||
)
|
||||
|
||||
set_target_properties(BenchmarkApp PROPERTIES MACOSX_BUNDLE TRUE)
|
||||
set_target_properties(BenchmarkApp PROPERTIES MACOSX_BUNDLE_IDENTIFIER com.mapbox.BenchmarkApp)
|
||||
set_target_properties(BenchmarkApp PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PROJECT_SOURCE_DIR}/benchmark/ios/Info.plist)
|
||||
set_target_properties(BenchmarkApp PROPERTIES RESOURCE "${RESOURCES}")
|
||||
set_target_properties(BenchmarkApp PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
|
||||
set_target_properties(BenchmarkApp PROPERTIES XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
|
||||
|
||||
find_package(XCTest REQUIRED)
|
||||
|
||||
xctest_add_bundle(BenchmarkAppTests BenchmarkApp ${PROJECT_SOURCE_DIR}/platform/ios/test/common/Tests.m)
|
||||
|
||||
target_include_directories(
|
||||
BenchmarkAppTests
|
||||
PUBLIC ${PROJECT_SOURCE_DIR}/benchmark/ios
|
||||
)
|
||||
|
||||
xctest_add_test(XCTest.BenchmarkApp BenchmarkAppTests)
|
||||
|
||||
set_target_properties(BenchmarkAppTests PROPERTIES XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "${IOS_DEPLOYMENT_TARGET}")
|
||||
set_target_properties(BenchmarkAppTests PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH $<$<CONFIG:Debug>:YES>)
|
||||
set_target_properties(BenchmarkAppTests PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PROJECT_SOURCE_DIR}/benchmark/ios/tests/Info.plist)
|
||||
set_target_properties(BenchmarkAppTests PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
|
||||
set_target_properties(BenchmarkAppTests PROPERTIES XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
|
||||
endif()
|
||||
|
||||
unset(IOS_DEPLOYMENT_TARGET CACHE)
|
||||
|
||||
Reference in New Issue
Block a user