Configure expression tests on CI (#1109)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Siarhei Fedartsou
2023-05-07 11:21:19 +02:00
committed by GitHub
parent f8c2c6c8b3
commit 3b50c2e857
4 changed files with 63 additions and 31 deletions

View File

@@ -49,7 +49,7 @@ jobs:
run: |
cmake --version
cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Debug -DMLN_WITH_CLANG_TIDY=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DMLN_WITH_COVERAGE=ON
cmake --build build --target mbgl-core mbgl-test-runner mbgl-render-test-runner
cmake --build build --target mbgl-core mbgl-test-runner mbgl-render-test-runner mbgl-expression-test
- name: Archive mbgl-test-runner
uses: actions/upload-artifact@v3
@@ -65,6 +65,13 @@ jobs:
path: build/mbgl-render-test-runner
retention-days: 1
- name: Archive mbgl-expression-test
uses: actions/upload-artifact@v3
with:
name: mbgl-expression-test
path: build/expression-test/mbgl-expression-test
retention-days: 1
test:
needs: build
runs-on: ubuntu-22.04
@@ -92,6 +99,21 @@ jobs:
- name: Run C++ tests
run: xvfb-run -a ./mbgl-test-runner
expression-test:
needs: build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Download mbgl-expression-test
uses: actions/download-artifact@v3
with:
name: mbgl-expression-test
- run: chmod +x ./mbgl-expression-test
- name: Run expression test
run: ./mbgl-expression-test
render-test:
needs: build
runs-on: ubuntu-22.04

View File

@@ -402,6 +402,7 @@ Ignores parseExpressionIgnores() {
}
std::optional<TestData> parseTestData(const filesystem::path& path) {
try {
TestData data;
auto maybeJson = readJson(path.string());
if (!maybeJson.is<JSDocument>()) { // NOLINT
@@ -433,6 +434,10 @@ std::optional<TestData> parseTestData(const filesystem::path& path) {
}
return {std::move(data)};
} catch (const std::exception& ex) {
Log::Error(Event::General, std::string("Cannot load test data from '" + path.string() + "': " + ex.what()));
return std::nullopt;
}
}
std::string toJSON(const Value& value, unsigned indent, bool singleLine) {

View File

@@ -47,7 +47,11 @@ int main(int argc, char** argv) try {
}
if (!testRun) {
if (shouldIgnore) {
stats.ignoreFailed.emplace_back(TestRunOutput{id});
} else {
stats.errored.emplace_back(id);
}
printf(ANSI_COLOR_RED "* ERROR can't parse '%s' test" ANSI_COLOR_RESET "\n", id.c_str());
continue;
}

View File

@@ -16,6 +16,7 @@
"expression-tests/legacy/interval/composite-default": "https://github.com/mapbox/mapbox-gl-native/issues/12747",
"expression-tests/legacy/interval/tokens-zoom": "https://github.com/mapbox/mapbox-gl-native/issues/12747",
"expression-tests/resolved-locale/basic": "Even the 'en' locale may not be present on some test systems.",
"expression-tests/within/non-supported": "Something is wrong with GeoJSON geometry in test",
"probes/file-size/fail-file-doesnt-match": "Should fail, doesn't match the expectation.",
"probes/file-size/fail-file-not-found": "Should fail, file not found.",
"probes/file-size/fail-size-is-over": "Should fail, size is bigger than expected.",