Browse Source

package/ci: exclude GL and Vk sources from code coverage on Windows.

I'm giving up there. Both Clang-cl and MinGW GCC report a far bigger
set of lines than their Linux / Mac counterparts (block ends, lines
containing just `else`, etc etc.), which wouldn't be a problem on its
own, if those lines would be covered. But on Windows there isn't a
single CI job that runs through GL/Vk codepaths -- as Mesa isn't easy to
get there and SwiftShader is utter crap -- which means there are extra
lines in GL/Vk codepaths that are reported as uncovered from Windows CI
jobs, while the same lines on Linux and Mac arere excluded and thus
there isn't anything that could make them green as well.
pull/680/head
Vladimír Vondruš 10 months ago
parent
commit
372edc13bc
  1. 11
      package/ci/appveyor-desktop-mingw.bat
  2. 11
      package/ci/appveyor-desktop.bat
  3. 8
      src/Magnum/ImageView.cpp

11
package/ci/appveyor-desktop-mingw.bat

@ -85,7 +85,16 @@ rem
rem Additionally, MinGW often reports empty lines containing just } as rem Additionally, MinGW often reports empty lines containing just } as
rem uncovered, possibly due to exception handling. Exclude them, and feel free rem uncovered, possibly due to exception handling. Exclude them, and feel free
rem to expand the regex to catch more cases if needed. rem to expand the regex to catch more cases if needed.
grcov build -t lcov --source-dir %APPVEYOR_BUILD_FOLDER%/build --keep-only "*/src/Magnum*/*" --ignore "*/src/MagnumExternal/*" --ignore "*/Test/*" --ignore "*/build/src/*" -o coverage.info --excl-line "(LCOV_EXCL_LINE|^\s*}$)" --excl-start LCOV_EXCL_START --excl-stop LCOV_EXCL_STOP || exit /b rem
rem Also, partially due to the above, where, if a code isn't run through at
rem all, a lot more uncovered lines is reported compared to Linux / Mac, the
rem whole GL and Vk libraries as well as any GL- or Vk-specific files are
rem ignored for code coverage here. They're still built and tested where
rem possible without an actual GL/Vk driver, but the false negatives far
rem outweigh the benefits of having Windows-specific coverage reported for
rem those -- there isn't any Windows-specific code for most of them, after all
rem -- that it's not worth including them.
grcov build -t lcov --source-dir %APPVEYOR_BUILD_FOLDER%/build --keep-only "*/src/Magnum*/*" --ignore "*/src/MagnumExternal/*" --ignore "*/Test/*" --ignore "*/build/src/*" --ignore "*/src/Magnum/GL/*" --ignore "*/src/Magnum/Vk/*" --ignore "*/src/Magnum/Platform/*" --ignore "*GL.cpp" --ignore "*GL.h" --ignore "*Vk.cpp" --ignore "*Vk.h" -o coverage.info --excl-line "(LCOV_EXCL_LINE|^\s*}$)" --excl-start LCOV_EXCL_START --excl-stop LCOV_EXCL_STOP || exit /b
rem Official docs say "not needed for public repos", in reality not using the rem Official docs say "not needed for public repos", in reality not using the
rem token is "extremely flakey". What's best is that if the upload fails, the rem token is "extremely flakey". What's best is that if the upload fails, the
rem damn thing exits with a success error code, and nobody cares: rem damn thing exits with a success error code, and nobody cares:

11
package/ci/appveyor-desktop.bat

@ -93,7 +93,16 @@ rem
rem Additionally, Clang-cl often reports empty lines containing just } as rem Additionally, Clang-cl often reports empty lines containing just } as
rem uncovered, possibly due to exception handling, similarly to MinGW. Exclude rem uncovered, possibly due to exception handling, similarly to MinGW. Exclude
rem them, and feel free to expand the regex to catch more cases if needed. rem them, and feel free to expand the regex to catch more cases if needed.
if "%COMPILER%" == "msvc-clang" if "%APPVEYOR_BUILD_WORKER_IMAGE%" == "Visual Studio 2022" grcov build -t lcov --keep-only "*/src/Magnum*/*" --ignore "*/src/MagnumExternal/*" --ignore "*/Test/*" --ignore "*/build/src/*" -o coverage.info --excl-line "(LCOV_EXCL_LINE|^\s*}$)" --excl-start LCOV_EXCL_START --excl-stop LCOV_EXCL_STOP || exit /b rem
rem Also, partially due to the above, where, if a code isn't run through at
rem all, a lot more uncovered lines is reported compared to Linux / Mac, the
rem whole GL and Vk libraries as well as any GL- or Vk-specific files are
rem ignored for code coverage here. They're still built and tested where
rem possible without an actual GL/Vk driver, but the false negatives far
rem outweigh the benefits of having Windows-specific coverage reported for
rem those -- there isn't any Windows-specific code for most of them, after all
rem -- that it's not worth including them.
if "%COMPILER%" == "msvc-clang" if "%APPVEYOR_BUILD_WORKER_IMAGE%" == "Visual Studio 2022" grcov build -t lcov --keep-only "*/src/Magnum*/*" --ignore "*/src/MagnumExternal/*" --ignore "*/Test/*" --ignore "*/build/src/*" --ignore "*/src/Magnum/GL/*" --ignore "*/src/Magnum/Vk/*" --ignore "*/src/Magnum/Platform/*" --ignore "*GL.cpp" --ignore "*GL.h" --ignore "*Vk.cpp" --ignore "*Vk.h" -o coverage.info --excl-line "(LCOV_EXCL_LINE|^\s*}$)" --excl-start LCOV_EXCL_START --excl-stop LCOV_EXCL_STOP || exit /b
rem Official docs say "not needed for public repos", in reality not using the rem Official docs say "not needed for public repos", in reality not using the
rem token is "extremely flakey". What's best is that if the upload fails, the rem token is "extremely flakey". What's best is that if the upload fails, the
rem damn thing exits with a success error code, and nobody cares: rem damn thing exits with a success error code, and nobody cares:

8
src/Magnum/ImageView.cpp

@ -35,7 +35,7 @@ template<UnsignedInt dimensions, class T> ImageView<dimensions, T>::ImageView(co
template<UnsignedInt dimensions, class T> ImageView<dimensions, T>::ImageView(const PixelStorage storage, const UnsignedInt format, const UnsignedInt formatExtra, const UnsignedInt pixelSize, const VectorTypeFor<dimensions, Int>& size, const Containers::ArrayView<ErasedType> data, const ImageFlags<dimensions> flags) noexcept: ImageView{storage, pixelFormatWrap(format), formatExtra, pixelSize, size, data, flags} {} template<UnsignedInt dimensions, class T> ImageView<dimensions, T>::ImageView(const PixelStorage storage, const UnsignedInt format, const UnsignedInt formatExtra, const UnsignedInt pixelSize, const VectorTypeFor<dimensions, Int>& size, const Containers::ArrayView<ErasedType> data, const ImageFlags<dimensions> flags) noexcept: ImageView{storage, pixelFormatWrap(format), formatExtra, pixelSize, size, data, flags} {}
template<UnsignedInt dimensions, class T> ImageView<dimensions, T>::ImageView(const PixelStorage storage, const PixelFormat format, const UnsignedInt formatExtra, const UnsignedInt pixelSize, const VectorTypeFor<dimensions, Int>& size, const Containers::ArrayView<ErasedType> data, const ImageFlags<dimensions> flags) noexcept: _storage{storage}, _format{format}, _formatExtra{formatExtra}, _pixelSize{UnsignedByte(pixelSize)}, _flags{flags}, _size{size}, _data{static_cast<Type*>(data.data()), data.size()} { template<UnsignedInt dimensions, class T> ImageView<dimensions, T>::ImageView(const PixelStorage storage, const PixelFormat format, const UnsignedInt formatExtra, const UnsignedInt pixelSize, const VectorTypeFor<dimensions, Int>& size, const Containers::ArrayView<ErasedType> data, const ImageFlags<dimensions> flags) noexcept: _storage{storage}, _format{format}, _formatExtra{formatExtra}, _pixelSize{UnsignedByte(pixelSize)}, _flags{flags}, _size{size}, _data{reinterpret_cast<Type*>(data.data()), data.size()} {
#ifndef CORRADE_NO_ASSERT #ifndef CORRADE_NO_ASSERT
Implementation::checkPixelSize("ImageView:", pixelSize); Implementation::checkPixelSize("ImageView:", pixelSize);
CORRADE_ASSERT(Implementation::imageDataSize(*this) <= _data.size(), "ImageView: data too small, got" << _data.size() << "but expected at least" << Implementation::imageDataSize(*this) << "bytes", ); CORRADE_ASSERT(Implementation::imageDataSize(*this) <= _data.size(), "ImageView: data too small, got" << _data.size() << "but expected at least" << Implementation::imageDataSize(*this) << "bytes", );
@ -60,7 +60,7 @@ template<UnsignedInt dimensions, class T> std::pair<VectorTypeFor<dimensions, st
template<UnsignedInt dimensions, class T> void ImageView<dimensions, T>::setData(const Containers::ArrayView<ErasedType> data) { template<UnsignedInt dimensions, class T> void ImageView<dimensions, T>::setData(const Containers::ArrayView<ErasedType> data) {
CORRADE_ASSERT(Implementation::imageDataSize(*this) <= data.size(), "ImageView::setData(): data too small, got" << data.size() << "but expected at least" << Implementation::imageDataSize(*this) << "bytes", ); CORRADE_ASSERT(Implementation::imageDataSize(*this) <= data.size(), "ImageView::setData(): data too small, got" << data.size() << "but expected at least" << Implementation::imageDataSize(*this) << "bytes", );
_data = {static_cast<Type*>(data.data()), data.size()}; _data = {reinterpret_cast<Type*>(data.data()), data.size()};
} }
template<UnsignedInt dimensions, class T> auto ImageView<dimensions, T>::pixels() const -> Containers::StridedArrayView<dimensions + 1, Type> { template<UnsignedInt dimensions, class T> auto ImageView<dimensions, T>::pixels() const -> Containers::StridedArrayView<dimensions + 1, Type> {
@ -78,7 +78,7 @@ template<UnsignedInt dimensions, class T> CompressedImageView<dimensions, T>::Co
compressedPixelFormatBlockDataSize(format) compressedPixelFormatBlockDataSize(format)
), size, data, flags} {} ), size, data, flags} {}
template<UnsignedInt dimensions, class T> CompressedImageView<dimensions, T>::CompressedImageView(const CompressedPixelStorage storage, const CompressedPixelFormat format, const Vector3i& blockSize, const UnsignedInt blockDataSize, const VectorTypeFor<dimensions, Int>& size, const Containers::ArrayView<ErasedType> data, const ImageFlags<dimensions> flags) noexcept: _storage{storage}, _format{format}, _flags{flags}, _blockSize{Vector3ub{blockSize}}, _blockDataSize{UnsignedByte(blockDataSize)}, _size{size}, _data{static_cast<Type*>(data.data()), data.size()} { template<UnsignedInt dimensions, class T> CompressedImageView<dimensions, T>::CompressedImageView(const CompressedPixelStorage storage, const CompressedPixelFormat format, const Vector3i& blockSize, const UnsignedInt blockDataSize, const VectorTypeFor<dimensions, Int>& size, const Containers::ArrayView<ErasedType> data, const ImageFlags<dimensions> flags) noexcept: _storage{storage}, _format{format}, _flags{flags}, _blockSize{Vector3ub{blockSize}}, _blockDataSize{UnsignedByte(blockDataSize)}, _size{size}, _data{reinterpret_cast<Type*>(data.data()), data.size()} {
#ifndef CORRADE_NO_ASSERT #ifndef CORRADE_NO_ASSERT
const bool passed = const bool passed =
Implementation::checkBlockProperties("CompressedImageView:", blockSize, blockDataSize); Implementation::checkBlockProperties("CompressedImageView:", blockSize, blockDataSize);
@ -125,7 +125,7 @@ template<UnsignedInt dimensions, class T> std::pair<VectorTypeFor<dimensions, st
template<UnsignedInt dimensions, class T> void CompressedImageView<dimensions, T>::setData(const Containers::ArrayView<ErasedType> data) { template<UnsignedInt dimensions, class T> void CompressedImageView<dimensions, T>::setData(const Containers::ArrayView<ErasedType> data) {
CORRADE_ASSERT(Implementation::compressedImageDataSize(*this) <= data.size(), "CompressedImageView::setData(): data too small, got" << data.size() << "but expected at least" << Implementation::compressedImageDataSize(*this) << "bytes", ); CORRADE_ASSERT(Implementation::compressedImageDataSize(*this) <= data.size(), "CompressedImageView::setData(): data too small, got" << data.size() << "but expected at least" << Implementation::compressedImageDataSize(*this) << "bytes", );
_data = {static_cast<Type*>(data.data()), data.size()}; _data = {reinterpret_cast<Type*>(data.data()), data.size()};
} }
template class MAGNUM_EXPORT ImageView<1, const char>; template class MAGNUM_EXPORT ImageView<1, const char>;

Loading…
Cancel
Save