Render Tests Maintenance (#2199)

This commit is contained in:
Bart Louwers
2024-03-15 15:57:56 +01:00
committed by GitHub
parent 41b7366285
commit 63ea5dc637
16 changed files with 6 additions and 309 deletions

View File

@@ -37,6 +37,8 @@ Run the configuration for the `MapboxGLAndroidSDKTestApp` module and select a de
To run the render tests for Android, run the configuration for the `androidRenderTest.app` module.
More information on working on the render tests can be found [in the wiki](https://github.com/maplibre/maplibre-native/wiki/Working-on-Android-Render-Tests).
## Instrumentation Tests
To run the instrumentatin tests, find the `MapboxGLAndroidSDKTestApp` project in the sidebar, go to `src > androidTest`, right click and select "Run 'All Tests'".

View File

@@ -1,6 +1,6 @@
# Distributing Mapbox GL Native for Android
# Distributing MapLibre Native for Android
Depending on your use case, you may want to support all or just a subset of [Android ABIs](http://developer.android.com/ndk/guides/abis.html). This document covers building an `.aar` file from the Mapbox Maps SDK for Android and building `.so` files for specific ABIs. In normal circumstances an application developer will use [APK splits](https://developer.android.com/studio/build/configure-apk-splits.html) to optimize this at application level.
Depending on your use case, you may want to support all or just a subset of [Android ABIs](http://developer.android.com/ndk/guides/abis.html). This document covers building an `.aar` file from the MapLibre Native for Android and building `.so` files for specific ABIs. In normal circumstances an application developer will use [APK splits](https://developer.android.com/studio/build/configure-apk-splits.html) to optimize this at application level.
##### Build types
@@ -24,7 +24,7 @@ This will build native libraries to support following ABIs:
- x86_64
- mips
After succesfully finish building the native libraries, gradle will build the MapboxAndroidSDK module and generate an Android Archive file in `MapboxAndroidSDK/build/outputs/aar `. The packaged native libraries can be found in `MapboxAndroidSDK/src/main/jniLibs/<abi>`.
After successfully finish building the native libraries, Gradle will build the MapboxAndroidSDK module and generate an Android Archive file in `MapboxAndroidSDK/build/outputs/aar `. The packaged native libraries can be found in `MapboxAndroidSDK/src/main/jniLibs/<abi>`.
##### Build native libraries for a specific ABI

View File

@@ -4,7 +4,7 @@ android {
compileSdkVersion 33
defaultConfig {
applicationId = 'com.mapbox.mapboxsdk.maps.render_test_runner'
applicationId = 'org.maplibre.render_test_runner'
minSdkVersion 21
targetSdkVersion 33
def abi = 'all'

View File

@@ -1,7 +1,3 @@
# iOS RenderTestRunner 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 RenderTestApp which is linked to the static C++ library 'mbgl-render-test'. 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-render-test` and calls running render test function on it. It subsequently deletes the C++ object pointer. In the end, the test will check the existence of test reports, which are html files that attach to xctest result.

View File

@@ -1,68 +0,0 @@
<?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>RenderTestAppTests</key>
<dict>
<key>BlueprintName</key>
<string>RenderTestAppTests</string>
<key>BundleIdentifiersForCrashReportEmphasis</key>
<array>
<string>com.mapbox.RenderTestApp</string>
<string>com.mapbox.RenderTestAppTests</string>
</array>
<key>CommandLineArguments</key>
<array/>
<key>DependentProductPaths</key>
<array>
<string>__TESTROOT__/Debug-iphoneos/RenderTestApp.app</string>
<string>__TESTROOT__/Debug-iphoneos/RenderTestApp.app/PlugIns/RenderTestAppTests.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>RenderTestAppTests</string>
<key>RunOrder</key>
<integer>0</integer>
<key>SystemAttachmentLifetime</key>
<string>deleteOnSuccess</string>
<key>TestBundlePath</key>
<string>__TESTHOST__/PlugIns/RenderTestAppTests.xctest</string>
<key>TestHostBundleIdentifier</key>
<string>com.mapbox.RenderTestApp</string>
<key>TestHostPath</key>
<string>__TESTROOT__/Debug-iphoneos/RenderTestApp.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>

View File

@@ -1,68 +0,0 @@
<?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>RenderTestAppTests</key>
<dict>
<key>BlueprintName</key>
<string>RenderTestAppTests</string>
<key>BundleIdentifiersForCrashReportEmphasis</key>
<array>
<string>com.mapbox.RenderTestApp</string>
<string>com.mapbox.RenderTestAppTests</string>
</array>
<key>CommandLineArguments</key>
<array/>
<key>DependentProductPaths</key>
<array>
<string>__TESTROOT__/Release-iphoneos/RenderTestApp.app</string>
<string>__TESTROOT__/Release-iphoneos/RenderTestApp.app/PlugIns/RenderTestAppTests.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>RenderTestAppTests</string>
<key>RunOrder</key>
<integer>0</integer>
<key>SystemAttachmentLifetime</key>
<string>deleteOnSuccess</string>
<key>TestBundlePath</key>
<string>__TESTHOST__/PlugIns/RenderTestAppTests.xctest</string>
<key>TestHostBundleIdentifier</key>
<string>com.mapbox.RenderTestApp</string>
<key>TestHostPath</key>
<string>__TESTROOT__/Release-iphoneos/RenderTestApp.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>

View File

@@ -1,16 +0,0 @@
<?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.RenderTestApp</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.RenderTestApp</string>
</array>
</dict>
</plist>

View File

@@ -1,16 +0,0 @@
<?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.RenderTestAppTests</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.RenderTestAppTests</string>
</array>
</dict>
</plist>

View File

@@ -1,16 +0,0 @@
<?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.RenderTestAppTests</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.RenderTestAppTests</string>
</array>
</dict>
</plist>

View File

@@ -1,16 +0,0 @@
<?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.RenderTestAppTests</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.RenderTestAppTests</string>
</array>
</dict>
</plist>

View File

@@ -1,11 +0,0 @@
#!/bin/bash
identity=$(/usr/bin/env xcrun security find-identity -v -p codesigning)
var=${identity#*1)\ }
CODE_SIGN_IDENTITY=${var%\ \"Apple\ Development*}
codesign --force --sign $CODE_SIGN_IDENTITY --entitlements codesigning/RenderTestApp.app.xcent --timestamp=none ./Release-iphoneos/RenderTestApp.app
codesign --force --sign $CODE_SIGN_IDENTITY --deep --preserve-metadata=identifier,entitlements,flags --timestamp=none ./Release-iphoneos/RenderTestApp.app/Frameworks/libXCTestSwiftSupport.dylib
codesign --force --sign $CODE_SIGN_IDENTITY --deep --preserve-metadata=identifier,entitlements,flags --timestamp=none ./Release-iphoneos/RenderTestApp.app/Frameworks/libXCTestBundleInject.dylib
codesign --force --sign $CODE_SIGN_IDENTITY --deep --preserve-metadata=identifier,entitlements,flags --timestamp=none ./Release-iphoneos/RenderTestApp.app/Frameworks/XCTAutomationSupport.framework
codesign --force --sign $CODE_SIGN_IDENTITY --deep --preserve-metadata=identifier,entitlements,flags --timestamp=none ./Release-iphoneos/RenderTestApp.app/Frameworks/XCTest.framework
codesign --force --sign $CODE_SIGN_IDENTITY --deep --entitlements codesigning/RenderTestAppTests.xctest.xcent --timestamp=none ./Release-iphoneos/RenderTestApp.app/PlugIns/RenderTestAppTests.xctest

View File

@@ -1,40 +0,0 @@
#!/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).")
}
}
}

View File

@@ -1,16 +0,0 @@
<?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.RenderTestAppTests</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.RenderTestAppTests</string>
</array>
</dict>
</plist>

View File

@@ -1,3 +0,0 @@
app_identifier("com.mapbox.RenderTestApp") # The bundle identifier of your app
apple_id ENV['MAPBOX_APPLE_ID']
team_id ENV['MAPBOX_APPLE_TEAM_ID'] # Developer Portal Team ID

View File

@@ -1,5 +0,0 @@
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.RenderTestApp", "com.mapbox.RenderTestAppTests"])
username ENV['MAPBOX_APPLE_ID']
keychain_name("fastlane_keychain")

View File

@@ -1,26 +0,0 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Give base directory as argument, eg. 'build'"
exit 1
fi
BASE_DIR=$1
rm -rf $BASE_DIR/test-data/
mkdir -p $BASE_DIR/test-data/integration/
mkdir -p $BASE_DIR/test-data/baselines/
cp -r metrics/integration/render-tests $BASE_DIR/test-data/integration/
cp -r metrics/integration/query-tests $BASE_DIR/test-data/integration/
cp -r metrics/expectations $BASE_DIR/test-data/
cp -r metrics/ignores $BASE_DIR/test-data/
cp -r metrics/tests $BASE_DIR/test-data/
cp -r metrics/ios-render-test-runner $BASE_DIR/test-data/
cp -r metrics/ios-render-test-runner-style.json $BASE_DIR/test-data/
cp -r metrics/ios-render-test-runner-metrics.json $BASE_DIR/test-data/
cp -r metrics/ios-metal-render-test-runner-style.json $BASE_DIR/test-data/
cp -r metrics/ios-metal-render-test-runner-metrics.json $BASE_DIR/test-data/
cp -r metrics/cache-metrics.db $BASE_DIR/test-data/
cp -r metrics/cache-style.db $BASE_DIR/test-data/