From 2f17d910b770b72d767265fffc268986148e6be1 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Wed, 7 Jun 2023 16:24:16 +0200 Subject: [PATCH] Include excluded tests in coverage report, use xorg-dummy-driver (#1193) --- .github/workflows/linux-ci.yml | 20 ++++++++------- BUILD.bazel | 5 +++- platform/linux/BUILD.bazel | 5 ++++ platform/linux/xorg/README.md | 5 ++++ platform/linux/xorg/startxwrapper | 8 ++++++ platform/linux/xorg/xorg.conf | 35 ++++++++++++++++++++++++++ test/BUILD.bazel | 14 +++++------ test/storage/sync_file_source.test.cpp | 10 +++++--- 8 files changed, 80 insertions(+), 22 deletions(-) create mode 100644 platform/linux/xorg/README.md create mode 100755 platform/linux/xorg/startxwrapper create mode 100644 platform/linux/xorg/xorg.conf diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml index 759cf50ce..8fd1d776a 100644 --- a/.github/workflows/linux-ci.yml +++ b/.github/workflows/linux-ci.yml @@ -88,7 +88,7 @@ jobs: name: mbgl-expression-test path: build/expression-test/mbgl-expression-test retention-days: 1 - + test: needs: build runs-on: ubuntu-22.04 @@ -107,7 +107,7 @@ jobs: name: mbgl-test-runner - run: chmod +x ./mbgl-test-runner - + - name: Install npm packages and run test server in background run: | npm install @@ -125,7 +125,7 @@ jobs: uses: actions/download-artifact@v3 with: name: mbgl-expression-test - + - run: chmod +x ./mbgl-expression-test - name: Run expression test @@ -147,7 +147,7 @@ jobs: uses: actions/download-artifact@v3 with: name: mbgl-render-test-runner - + - run: chmod +x ./mbgl-render-test-runner - name: Run render test @@ -185,7 +185,9 @@ jobs: libuv1-dev \ libjpeg-dev \ libpng-dev \ - libglfw3-dev + libglfw3-dev \ + xserver-xorg-video-dummy \ + xinit - name: Cache Bazel uses: actions/cache@v2 @@ -194,15 +196,15 @@ jobs: restore-keys: | ${{ runner.os }}-bazel- path: ~/.cache/bazel - + - name: Start server run: | npm install --ignore-scripts node test/storage/server.js & - + - name: Generate coverage report - run: | - bazel coverage --test_output=all --combined_report=lcov --instrumentation_filter="//:mbgl-core" //test:core --//:maplibre_platform=linux --run_under="xvfb-run -a" + run: | + bazel coverage --test_output=all --combined_report=lcov --instrumentation_filter="//:mbgl-core" //test:core --//:maplibre_platform=linux --run_under=//platform/linux:startxwrapper echo coverage_report=$(bazel info output_path)/_coverage/_coverage_report.dat >> $GITHUB_ENV - name: Upload coverage report diff --git a/BUILD.bazel b/BUILD.bazel index eb83ca5d0..638244537 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -86,6 +86,9 @@ config_setting( ) exports_files( - ["LICENSE.md"], + [ + "LICENSE.md", + "scripts/style-spec-reference/v8.json", + ], visibility = ["//visibility:public"], ) diff --git a/platform/linux/BUILD.bazel b/platform/linux/BUILD.bazel index b7b885b90..dfbc21b1f 100644 --- a/platform/linux/BUILD.bazel +++ b/platform/linux/BUILD.bazel @@ -30,3 +30,8 @@ cc_library( "//platform/default:mbgl-default", ], ) + +sh_binary( + name = "startxwrapper", + srcs = ["xorg/startxwrapper"], +) diff --git a/platform/linux/xorg/README.md b/platform/linux/xorg/README.md new file mode 100644 index 000000000..c84a1994b --- /dev/null +++ b/platform/linux/xorg/README.md @@ -0,0 +1,5 @@ +# Xorg dummy driver + +This directory contains an `xorg.conf` that uses the Xorg dummy driver. + +It can be used as an alternative to `xvfb-run`. \ No newline at end of file diff --git a/platform/linux/xorg/startxwrapper b/platform/linux/xorg/startxwrapper new file mode 100755 index 000000000..8e7476a61 --- /dev/null +++ b/platform/linux/xorg/startxwrapper @@ -0,0 +1,8 @@ +#!/usr/bin/bash + +script=$(realpath "$0") +scriptpath=$(dirname "$script") + +exit_code=$(mktemp) +XAUTHORITY=$(mktemp) startx "$PWD/$@ && echo $? > $exit_code" -- -xf86config "$scriptpath/xorg.conf" -logfile /dev/null +exit $(cat $exit_code) \ No newline at end of file diff --git a/platform/linux/xorg/xorg.conf b/platform/linux/xorg/xorg.conf new file mode 100644 index 000000000..8f8591648 --- /dev/null +++ b/platform/linux/xorg/xorg.conf @@ -0,0 +1,35 @@ +# This xorg.conf is used with the xserver-xorg-video-dummy driver in the workflows + +Section "Monitor" +Identifier "Monitor0" +HorizSync 28.0-80.0 +VertRefresh 48.0-75.0 +# 1024x768 @ 60.00 Hz (GTF) hsync: 47.70 kHz; pclk: 64.11 MHz +# Modeline "1024x768_60.00" 64.11 1024 1080 1184 1344 768 769 772 795 -HSync +Vsync +# 1280x720 @ 60.00 Hz (GTF) hsync: 44.76 kHz; pclk: 74.48 MHz +# Modeline "1280x720_60.00" 74.48 1280 1336 1472 1664 720 721 724 746 -HSync +Vsync +# 1368x768 @ 60.00 Hz (GTF) hsync: 47.70 kHz; pclk: 85.86 MHz +# Modeline "1368x768_60.00" 85.86 1368 1440 1584 1800 768 769 772 795 -HSync +Vsync +# 1600x900 @ 60.00 Hz (GTF) hsync: 55.92 kHz; pclk: 119.00 MHz +# Modeline "1600x900_60.00" 119.00 1600 1696 1864 2128 900 901 904 932 -HSync +Vsync +# 1920x1080 @ 60.00 Hz (GTF) hsync: 67.08 kHz; pclk: 172.80 MHz +Modeline "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync +EndSection + +Section "Device" +Identifier "Card0" +Option "NoDDC" "true" +Option "IgnoreEDID" "true" +Driver "dummy" +EndSection + +Section "Screen" +DefaultDepth 16 +Identifier "Screen0" +Device "Card0" +Monitor "Monitor0" + SubSection "Display" + Depth 16 + Modes "1920x1080" + EndSubSection +EndSection \ No newline at end of file diff --git a/test/BUILD.bazel b/test/BUILD.bazel index 7e6734fb6..80599ec9b 100644 --- a/test/BUILD.bazel +++ b/test/BUILD.bazel @@ -39,16 +39,14 @@ cc_test( [ "**/*.test.cpp", ], - exclude = [ - "storage/sync_file_source.test.cpp", - "util/timer.test.cpp", - "style/expression/expression.test.cpp", - "map/map.test.cpp", - ], ), + args = [ + "--gtest_filter=-Map.StyleNetworkErrorRetry:Map.StyleNotFound", + ], copts = CPP_FLAGS + MAPLIBRE_FLAGS, - data = glob(["fixtures/**/*"]), - local = True, + data = glob(["fixtures/**/*"]) + [ + "//:scripts/style-spec-reference/v8.json", + ], deps = [ "testlib", "testutils", diff --git a/test/storage/sync_file_source.test.cpp b/test/storage/sync_file_source.test.cpp index 572f4eb4f..5d108929b 100644 --- a/test/storage/sync_file_source.test.cpp +++ b/test/storage/sync_file_source.test.cpp @@ -9,6 +9,8 @@ #include #include #include +#include "mbgl/storage/resource_options.hpp" +#include "mbgl/util/client_options.hpp" #include @@ -35,13 +37,13 @@ public: assets.emplace(key, std::make_shared(data)); }; - virtual void setResourceOptions(ResourceOptions _) override { throw std::runtime_error("Not implemented"); } + virtual void setResourceOptions(ResourceOptions) override {} - virtual ResourceOptions getResourceOptions() override { throw std::runtime_error("Not implemented"); } + virtual ResourceOptions getResourceOptions() override { return ResourceOptions{}; } - virtual void setClientOptions(ClientOptions) override { throw std::runtime_error("Not implemented"); } + virtual void setClientOptions(ClientOptions) override {} - virtual ClientOptions getClientOptions() { throw std::runtime_error("Not implemented"); } + virtual ClientOptions getClientOptions() { return ClientOptions{}; } private: std::unordered_map> assets;