diff options
author | Juha Alanen <juha.alanen@mapbox.com> | 2020-02-12 14:05:22 +0200 |
---|---|---|
committer | Juha Alanen <juha.alanen@mapbox.com> | 2020-02-18 16:10:23 +0200 |
commit | cea87c9f2d0eb66e3a918d1b84e316b27462dd07 (patch) | |
tree | 389fff07f377377e34887f6a46f370ff55a445c1 /benchmark | |
parent | a5ec862a2a241885918d4d843bbc93c3804a57e6 (diff) | |
download | qtlocation-mapboxgl-cea87c9f2d0eb66e3a918d1b84e316b27462dd07.tar.gz |
[benchmark] Add iOS benchmark runner
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/CMakeLists.txt | 12 | ||||
-rw-r--r-- | benchmark/ios/BenchmarkApp_iphoneos13.2-arm64e-debug.xctestrun | 68 | ||||
-rw-r--r-- | benchmark/ios/BenchmarkApp_iphoneos13.2-arm64e-release.xctestrun | 68 | ||||
-rw-r--r-- | benchmark/ios/Info.plist | 62 | ||||
-rw-r--r-- | benchmark/ios/README.md | 7 | ||||
-rw-r--r-- | benchmark/ios/codesigning/BenchmarkApp.app.xcent.template | 16 | ||||
-rw-r--r-- | benchmark/ios/codesigning/BenchmarkAppTests.xctest.xcent.template | 16 | ||||
-rw-r--r-- | benchmark/ios/codesigning/XCTAutomationSupport.framework.xcent.template | 16 | ||||
-rw-r--r-- | benchmark/ios/codesigning/XCTest.framework.xcent.template | 16 | ||||
-rwxr-xr-x | benchmark/ios/codesigning/codesign_all.sh | 8 | ||||
-rwxr-xr-x | benchmark/ios/codesigning/generate-entitlements.swift | 40 | ||||
-rw-r--r-- | benchmark/ios/codesigning/libXCTestSwiftSupport.dylib.xcent.template | 16 | ||||
-rw-r--r-- | benchmark/ios/fastlane/Appfile | 3 | ||||
-rw-r--r-- | benchmark/ios/fastlane/Matchfile | 5 | ||||
-rw-r--r-- | benchmark/ios/iosTestRunner.h | 12 | ||||
-rw-r--r-- | benchmark/ios/ios_test_runner.cpp | 34 | ||||
-rw-r--r-- | benchmark/ios/tests/Info.plist | 22 |
17 files changed, 421 insertions, 0 deletions
diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index a619bfbd36..ab21fe3302 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -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) diff --git a/benchmark/ios/BenchmarkApp_iphoneos13.2-arm64e-debug.xctestrun b/benchmark/ios/BenchmarkApp_iphoneos13.2-arm64e-debug.xctestrun new file mode 100644 index 0000000000..4270610f09 --- /dev/null +++ b/benchmark/ios/BenchmarkApp_iphoneos13.2-arm64e-debug.xctestrun @@ -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> diff --git a/benchmark/ios/BenchmarkApp_iphoneos13.2-arm64e-release.xctestrun b/benchmark/ios/BenchmarkApp_iphoneos13.2-arm64e-release.xctestrun new file mode 100644 index 0000000000..6c6d73f3bf --- /dev/null +++ b/benchmark/ios/BenchmarkApp_iphoneos13.2-arm64e-release.xctestrun @@ -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> diff --git a/benchmark/ios/Info.plist b/benchmark/ios/Info.plist new file mode 100644 index 0000000000..0c6fd61441 --- /dev/null +++ b/benchmark/ios/Info.plist @@ -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>
\ No newline at end of file diff --git a/benchmark/ios/README.md b/benchmark/ios/README.md new file mode 100644 index 0000000000..5ee2a9aa34 --- /dev/null +++ b/benchmark/ios/README.md @@ -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. diff --git a/benchmark/ios/codesigning/BenchmarkApp.app.xcent.template b/benchmark/ios/codesigning/BenchmarkApp.app.xcent.template new file mode 100644 index 0000000000..669e8cdc54 --- /dev/null +++ b/benchmark/ios/codesigning/BenchmarkApp.app.xcent.template @@ -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>
\ No newline at end of file diff --git a/benchmark/ios/codesigning/BenchmarkAppTests.xctest.xcent.template b/benchmark/ios/codesigning/BenchmarkAppTests.xctest.xcent.template new file mode 100644 index 0000000000..4070d8939c --- /dev/null +++ b/benchmark/ios/codesigning/BenchmarkAppTests.xctest.xcent.template @@ -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>
\ No newline at end of file diff --git a/benchmark/ios/codesigning/XCTAutomationSupport.framework.xcent.template b/benchmark/ios/codesigning/XCTAutomationSupport.framework.xcent.template new file mode 100644 index 0000000000..4070d8939c --- /dev/null +++ b/benchmark/ios/codesigning/XCTAutomationSupport.framework.xcent.template @@ -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>
\ No newline at end of file diff --git a/benchmark/ios/codesigning/XCTest.framework.xcent.template b/benchmark/ios/codesigning/XCTest.framework.xcent.template new file mode 100644 index 0000000000..4070d8939c --- /dev/null +++ b/benchmark/ios/codesigning/XCTest.framework.xcent.template @@ -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>
\ No newline at end of file diff --git a/benchmark/ios/codesigning/codesign_all.sh b/benchmark/ios/codesigning/codesign_all.sh new file mode 100755 index 0000000000..70f5aee74b --- /dev/null +++ b/benchmark/ios/codesigning/codesign_all.sh @@ -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 diff --git a/benchmark/ios/codesigning/generate-entitlements.swift b/benchmark/ios/codesigning/generate-entitlements.swift new file mode 100755 index 0000000000..83834483bf --- /dev/null +++ b/benchmark/ios/codesigning/generate-entitlements.swift @@ -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).") + } + } +}
\ No newline at end of file diff --git a/benchmark/ios/codesigning/libXCTestSwiftSupport.dylib.xcent.template b/benchmark/ios/codesigning/libXCTestSwiftSupport.dylib.xcent.template new file mode 100644 index 0000000000..4070d8939c --- /dev/null +++ b/benchmark/ios/codesigning/libXCTestSwiftSupport.dylib.xcent.template @@ -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>
\ No newline at end of file diff --git a/benchmark/ios/fastlane/Appfile b/benchmark/ios/fastlane/Appfile new file mode 100644 index 0000000000..af5ebdffa7 --- /dev/null +++ b/benchmark/ios/fastlane/Appfile @@ -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
\ No newline at end of file diff --git a/benchmark/ios/fastlane/Matchfile b/benchmark/ios/fastlane/Matchfile new file mode 100644 index 0000000000..f8fe804638 --- /dev/null +++ b/benchmark/ios/fastlane/Matchfile @@ -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")
\ No newline at end of file diff --git a/benchmark/ios/iosTestRunner.h b/benchmark/ios/iosTestRunner.h new file mode 100644 index 0000000000..d8cd7991b1 --- /dev/null +++ b/benchmark/ios/iosTestRunner.h @@ -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 diff --git a/benchmark/ios/ios_test_runner.cpp b/benchmark/ios/ios_test_runner.cpp new file mode 100644 index 0000000000..25bd3add5d --- /dev/null +++ b/benchmark/ios/ios_test_runner.cpp @@ -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; +} diff --git a/benchmark/ios/tests/Info.plist b/benchmark/ios/tests/Info.plist new file mode 100644 index 0000000000..83e7a9a080 --- /dev/null +++ b/benchmark/ios/tests/Info.plist @@ -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> |