Skip to content

Commit

Permalink
Opensource (tools) tests as part of runtime
Browse files Browse the repository at this point in the history
- Most of tools/* have been moved to the new packages/runtime/tests. (Excludes fuzz and a few things with proprietary information)

- The tools/test are now in packages/runtime/unit_tests/renderer.

- The runtime/tests are now also moved, to the following packages/runtime/unit_tests/runtime (moved the "dev/tests" to packages/runtime/unit_tests)

- Thus unit_tests comprises of runtime and renderer tests (in the future we can add more categories as folder, this avoids too many tests in one folder)

- The rendering tests and runtime tests are built together in one executable called unit_tests*. This is what is described in the rive-runtime README - it is the way our developers can test the rendering (GPU) and runtime (CPU) unit tests in one go.

- pr_runtime_tests now builds and runs all the unit_tests, previously it was only executing the runtime tests, but now it includes the renderer tests for the (same platforms still tested: windows, windows msvc, mac, linux)

- The pr_tools_tests still tests the same workloads on the same devices, limited still to the rendering tests

ISSUES:

- We cannot build all the "tools" tests (e.g. imagediff, rendering tests) with the runtime tests. The runtime tests enables TESTING. I'm also not sure if running the runtime tests on all the devices is actually is worth it - if the tests are platform+device agnostic then probably not worth it.

- Windows pr_runtime_tests switched to ws-actions/configure-aws-credentials@v1 from microsoft/[email protected], as would not build otherwise, seems related to old version of premake

TODO:

- Verify of the performance is reasonable for runner / checkins

Diffs=
f25ee97a0 Opensource (tools) tests as part of runtime (#8035)

Co-authored-by: rivessamr <[email protected]>
  • Loading branch information
rivessamr and rivessamr committed Sep 3, 2024
1 parent f07269d commit 5207dd8
Show file tree
Hide file tree
Showing 342 changed files with 332,445 additions and 1,055 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Tests
run: |
cd dev
cd tests/unit_tests
./test.sh
build-windows:
Expand All @@ -37,7 +37,7 @@ jobs:
- uses: actions/checkout@v2
- name: Tests
run: |
cd dev
cd tests/unit_tests
./test.sh
build-macos:
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
if: matrix.platform == 'macOS'
run: |
echo Testing for ${{matrix.platform}}
cd dev
cd tests/unit_tests
./test.sh
- name: Tess Tests
Expand Down
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
39b803c5886b7df76471e58e8584744b86296c17
f25ee97a05aaa30a58b13451c8020c4e1c095bed
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ To build viewer (plus you'll needed CMake installed)
Uses the [Catch2](https://github.com/catchorg/Catch2) testing framework.

```
cd dev
cd tests/unit_tests
./test.sh
```

In the ```dev``` directory, run ```test.sh``` to compile and execute the tests.
In the ```tests/unit_tests``` directory, run ```test.sh``` to compile and execute the tests.

(if you've installed `premake5` in `rive-cpp/build`, you can run it with `PATH=../../build:$PATH ./test.sh`)
(if you've installed `premake5` in `rive-runtime/build`, you can run it with `PATH=../../build:$PATH ./test.sh`)

The tests live in ```rive/test```. To add new tests, create a new ```xxx_test.cpp``` file here. The test harness will automatically pick up the new file.

Expand Down
2 changes: 1 addition & 1 deletion dependencies/windows/get_premake5.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pushd %DEPENDENCIES%
if not exist ".\bin" mkdir bin
echo Downloading Premake5
curl https://github.com/premake/premake-core/releases/download/v5.0.0-beta1/premake-5.0.0-beta1-windows.zip -L -o .\bin\premake_windows.zip
curl https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-windows.zip -L -o .\bin\premake_windows.zip
pushd bin
:: Export premake5 into bin
tar -xf premake_windows.zip
Expand Down
4 changes: 2 additions & 2 deletions include/rive/animation/animation_reset_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class AnimationResetFactory
static void release(std::unique_ptr<AnimationReset> value);
#ifdef TESTING
// Used in testing to check pooled resources;
static int resourcesCount() { return m_resources.size(); };
static int resourcesCount() { return static_cast<int>(m_resources.size()); };
static void releaseResources() { m_resources.clear(); };
#endif
};
} // namespace rive
#endif
#endif
3 changes: 1 addition & 2 deletions tess/build/premake5_tess.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ do
targetdir('%{cfg.system}/bin/%{cfg.buildcfg}')
objdir('%{cfg.system}/obj/%{cfg.buildcfg}')
includedirs({
rive .. 'dev/test/include', -- for catch.hpp
rive .. 'test', -- for things like rive_file_reader.hpp
rive .. 'tests/include', -- for catch.hpp and for things rive_file_reader.hpp
'../include',
rive .. '/include',
dependencies .. '/sokol',
Expand Down
1,433 changes: 540 additions & 893 deletions tess/src/sokol/generated/shader.h

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tests/android_tools/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
69 changes: 69 additions & 0 deletions tests/android_tools/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.jetbrainsKotlinAndroid)
}

android {
namespace = "app.rive.android_tools"
compileSdk = 34

defaultConfig {
applicationId = "app.rive.android_tools"
minSdk = 21
targetSdk = 34
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.1"
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

dependencies {

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)
}
21 changes: 21 additions & 0 deletions tests/android_tools/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
59 changes: 59 additions & 0 deletions tests/android_tools/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Android_tools"
tools:targetApi="31">
<activity android:name=".gms"
android:label="android_tools_gms"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait"
android:exported="true">
<!-- Tell NativeActivity the name of our .so -->
<meta-data android:name="android.app.lib_name"
android:value="gms" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".goldens"
android:label="android_tools_goldens"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait"
android:exported="true">
<!-- Tell NativeActivity the name of our .so -->
<meta-data android:name="android.app.lib_name"
android:value="goldens" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".player"
android:label="android_tools_player"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait"
android:exported="true">
<!-- Tell NativeActivity the name of our .so -->
<meta-data android:name="android.app.lib_name"
android:value="player" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package app.rive.android_tools

import android.app.NativeActivity

class gms : NativeActivity() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package app.rive.android_tools

import android.app.NativeActivity

class goldens : NativeActivity() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package app.rive.android_tools

import android.app.NativeActivity

class player : NativeActivity() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
Loading

0 comments on commit 5207dd8

Please sign in to comment.