Page MenuHome

Tests: bundle tests for some modules in their own executables
ClosedPublic

Authored by Brecht Van Lommel (brecht) on Aug 26 2020, 2:44 PM.

Details

Summary

The ffmpeg, guardedalloc and blenlib are quite isolated and putting them in
their own executable separate from blender_test is faster for development than
linking the entire blender_tests executable.

For Cycles, this also bundles all the unit tests into one executable.

I also considered going back to having every test file in its own executable,
but the size of these executables does add up quickly, and linking and running
all blenlib tests is still < 1s here.

Ref T79958

Diff Detail

Repository
rB Blender
Branch
test-exe (branched from master)
Build Status
Buildable 9805
Build 9805: arc lint + arc unit

Event Timeline

Brecht Van Lommel (brecht) requested review of this revision.Aug 26 2020, 2:44 PM
Brecht Van Lommel (brecht) created this revision.
Ray Molenkamp (LazyDodo) requested changes to this revision.Aug 26 2020, 3:31 PM

winstuff.c uses G.background to figure out if we're in background mode, which causes a link error for blenlib_test.exe

Also i'll leave it up to you if you want to fix this but the cycles test is spewing a scary looking (but harmless) warn if you run with -VV i don't remember seeing before.

51: GMOCK WARNING:
51: Uninteresting mock function call - returning directly.
51:     Function call: Log(0, @000000DC9FDFECC8 "K:\\BlenderGit\\blender\\intern\\cycles\\device\\device_cpu.cpp", @000000DC9FDFECE8 "Will be using AVX kernels.")
51: NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/master/googlemock/docs/cook_book.md#knowing-when-to-expect for details.

it's somewhat strange that the constant folder has no issue logging later on (still with -VV, it's not that chatty normally)

51: [ RUN      ] RenderGraph.constant_fold_shader_mix
51: I0826 07:26:00.568676  8892 constant_fold.cpp:113] Folding MixClosure1::Closure to socket Diffuse::BSDF.
51: I0826 07:26:00.568676  8892 constant_fold.cpp:113] Folding MixClosure2::Closure to socket Diffuse::BSDF.
51: I0826 07:26:00.568676  8892 constant_fold.cpp:113] Folding MixClosure3::Closure to socket Diffuse::BSDF.
51: [       OK ] RenderGraph.constant_fold_shader_mix (0 ms)
This revision now requires changes to proceed.Aug 26 2020, 3:31 PM
Brecht Van Lommel (brecht) requested review of this revision.Aug 26 2020, 7:33 PM

Fixed the winstuff issue in rBf699ba3d30ec: Cleanup: better naming and no bad level access in BLI_winstuff.

51: GMOCK WARNING:
51: Uninteresting mock function call - returning directly.
51:     Function call: Log(0, @000000DC9FDFECC8 "K:\\BlenderGit\\blender\\intern\\cycles\\device\\device_cpu.cpp", @000000DC9FDFECE8 "Will be using AVX kernels.")
51: NOTE: You can safely ignore the above warning unless this call should not happen.  Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call.  See https://github.com/google/googletest/blob/master/googlemock/docs/cook_book.md#knowing-when-to-expect for details.

I see that as well in master without this patch, I commit a fix for that separately.

Builds now, but it has issues running the test discovery due the working dir being wrong

CMake Error at K:/BlenderGit/blender/build_files/cmake/Modules/GTestAddTests.cmake:81 (message):
  Error running test executable.

    Path: 'K:/BlenderGit/test_2019_release/bin/tests/Release/ffmpeg_test.exe'
    Working Dir: 'K:/BlenderGit/test_2019_release/intern/ffmpeg'  (added this my self, for diagnostics)
    Result: Exit code 0xc0000135

all dll's it needs are in the blender binary folder, so the working dir needs to be that

  • Merge remote-tracking branch 'origin/master' into arcpatch-D8714
  • Fix working directory on windows.

fixed, the working dir, LGTM now!

This revision is now accepted and ready to land.Aug 26 2020, 10:39 PM

This worked great for me on Linux, with a blissfully short startup time for gdb on blenlib_test. Thanks!

When I tried applying this patch on MacOS, I got linker errors. Like this, when I tried to make just blenlib_test:

Ld /Users/howardtrickey/src/blender-git/build/bin/tests/blenlib_test normal x86_64

cd /Users/howardtrickey/src/blender-git/blender
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -target x86_64-apple-macos10.13 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -L/Users/howardtrickey/src/blender-git/build/bin/tests -F/Users/howardtrickey/src/blender-git/build/bin/tests -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks -filelist /Users/howardtrickey/src/blender-git/build/source/blender/blenlib/Blender.build/Debug/blenlib_test.build/Objects-normal/x86_64/blenlib_test.LinkFileList -Xlinker -object_path_lto -Xlinker /Users/howardtrickey/src/blender-git/build/source/blender/blenlib/Blender.build/Debug/blenlib_test.build/Objects-normal/x86_64/blenlib_test_lto.o -Xlinker -no_deduplicate -stdlib=libc++ -L/Users/howardtrickey/src/blender-git/blender/../lib/darwin/openmp/lib -lomp -Wl,-search_paths_first -Wl,-headerpad_max_install_names /Users/howardtrickey/src/blender-git/build/lib/Debug/libbf_intern_eigen.a /Users/howardtrickey/src/blender-git/build/lib/Debug/libbf_intern_guardedalloc.a /Users/howardtrickey/src/blender-git/build/lib/Debug/libbf_intern_numaapi.a /Users/howardtrickey/src/blender-git/build/lib/Debug/libextern_wcwidth.a -lfreetype -lz -lbz2 /Users/howardtrickey/src/blender-git/lib/darwin/tbb/lib/libtbb.a /Users/howardtrickey/src/blender-git/build/lib/Debug/libbf_blenlib.a -lc++ /Users/howardtrickey/src/blender-git/lib/darwin/tbb/lib/libtbb.a /Users/howardtrickey/src/blender-git/lib/darwin/openimagedenoise/lib/libOpenImageDenoise.a /Users/howardtrickey/src/blender-git/lib/darwin/openimagedenoise/lib/libcommon.a /Users/howardtrickey/src/blender-git/lib/darwin/openimagedenoise/lib/libdnnl.a /Users/howardtrickey/src/blender-git/build/lib/Debug/libbf_testing_main.a /Users/howardtrickey/src/blender-git/build/lib/Debug/libbf_intern_eigen.a /Users/howardtrickey/src/blender-git/build/lib/Debug/libbf_intern_guardedalloc.a /Users/howardtrickey/src/blender-git/build/lib/Debug/libextern_gtest.a /Users/howardtrickey/src/blender-git/build/lib/Debug/libextern_gmock.a /Users/howardtrickey/src/blender-git/build/lib/Debug/libextern_glog.a /Users/howardtrickey/src/blender-git/build/lib/Debug/libextern_gflags.a /Users/howardtrickey/src/blender-git/lib/darwin/tbb/lib/libtbb.a /Users/howardtrickey/src/blender-git/build/lib/Debug/libbf_intern_numaapi.a /Users/howardtrickey/src/blender-git/build/lib/Debug/libextern_wcwidth.a -lfreetype -lz -lbz2 /Users/howardtrickey/src/blender-git/lib/darwin/tbb/lib/libtbb.a -Xlinker -dependency_info -Xlinker /Users/howardtrickey/src/blender-git/build/source/blender/blenlib/Blender.build/Debug/blenlib_test.build/Objects-normal/x86_64/blenlib_test_dependency_info.dat -o /Users/howardtrickey/src/blender-git/build/bin/tests/blenlib_test

ld: library not found for -lfreetype
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I didn't test on macOS, but I expect this will work.

The latest patch still fails on MacOs unfortunately. I get this linker error now (the paths exist on my machine up to but not including the Debug last components):

ld: warning: directory not found for option '-L/Users/howardtrickey/src/blender-git/blender/../lib/darwin/jpeg/lib/Debug'
ld: warning: directory not found for option '-L/Users/howardtrickey/src/blender-git/blender/../lib/darwin/png/lib/Debug'
ld: warning: directory not found for option '-L/Users/howardtrickey/src/blender-git/blender/../lib/darwin/freetype/lib/Debug'
ld: warning: directory not found for option '-L/Users/howardtrickey/src/blender-git/blender/../lib/darwin/python/lib/python3.7/Debug'
ld: warning: directory not found for option '-L/Users/howardtrickey/src/blender-git/blender/../lib/darwin/sdl/lib/Debug'
ld: warning: directory not found for option '-L/Users/howardtrickey/src/blender-git/blender/../lib/darwin/ffmpeg/lib/Debug'
ld: warning: directory not found for option '-L/Users/howardtrickey/src/blender-git/blender/../lib/darwin/openexr/lib/Debug'
ld: warning: directory not found for option '-L/Users/howardtrickey/src/blender-git/blender/../lib/darwin/tiff/lib/Debug'
ld: warning: directory not found for option '-L/Users/howardtrickey/src/blender-git/blender/../lib/darwin/boost/lib/Debug'
ld: warning: directory not found for option '-L/Users/howardtrickey/src/blender-git/blender/../lib/darwin/openimageio/lib/Debug'
ld: warning: directory not found for option '-L/Users/howardtrickey/src/blender-git/blender/../lib/darwin/opencolorio/lib/Debug'
ld: warning: directory not found for option '-L/Users/howardtrickey/src/blender-git/blender/../lib/darwin/openvdb/lib/Debug'
ld: warning: directory not found for option '-L/Users/howardtrickey/src/blender-git/blender/../lib/darwin/sndfile/lib/Debug'
ld: warning: directory not found for option '-L/Users/howardtrickey/src/blender-git/blender/../lib/darwin/fftw3/lib/Debug'
ld: warning: directory not found for option '-L/Users/howardtrickey/src/blender-git/blender/../lib/darwin/opencollada/lib/Debug'
ld: warning: directory not found for option '-L/Users/howardtrickey/src/blender-git/lib/darwin/llvm/lib/Debug'
ld: warning: directory not found for option '-L/Users/howardtrickey/src/blender-git/blender/../lib/darwin/alembic/lib/Debug'
Undefined symbols for architecture x86_64:

"_objc_getClass", referenced from:
    _delete_soft in libbf_blenlib.a(fileops.o)
"_objc_msgSend", referenced from:
    _delete_soft in libbf_blenlib.a(fileops.o)
"_sel_registerName", referenced from:
    _delete_soft in libbf_blenlib.a(fileops.o)

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)