GNOME Bugzilla – Bug 785960
test_BlockSpecial fails
Last modified: 2018-07-09 10:02:32 UTC
I tried building gparted 0.29 on Ubuntu 17.10 Alpha with sbuild/schroot but I'm getting some test failures. Any suggestions? FAIL: test_BlockSpecial ======================= Running main() from gtest_main.cc [==========] Running 26 tests from 1 test case. [----------] Global test environment set-up. [----------] 26 tests from BlockSpecialTest [ RUN ] BlockSpecialTest.UnnamedBlockSpecialObject [ OK ] BlockSpecialTest.UnnamedBlockSpecialObject (0 ms) [ RUN ] BlockSpecialTest.NamedBlockSpecialObjectPlainFile [ OK ] BlockSpecialTest.NamedBlockSpecialObjectPlainFile (0 ms) [ RUN ] BlockSpecialTest.NamedBlockSpecialObjectPlainFileDuplicate [ OK ] BlockSpecialTest.NamedBlockSpecialObjectPlainFileDuplicate (0 ms) [ RUN ] BlockSpecialTest.NamedBlockSpecialObjectBlockDevice test_BlockSpecial.cc:214: Failure Value of: bs.m_major > 0 || bs.m_minor > 0 Actual: false Expected: true [ FAILED ] BlockSpecialTest.NamedBlockSpecialObjectBlockDevice (0 ms) [ RUN ] BlockSpecialTest.NamedBlockSpecialObjectBlockDeviceDuplicate [ OK ] BlockSpecialTest.NamedBlockSpecialObjectBlockDeviceDuplicate (0 ms) [ RUN ] BlockSpecialTest.TwoNamedBlockSpecialObjectBlockDevices test_BlockSpecial.cc:242: Failure Value of: bs1.m_major != bs2.m_major || bs1.m_minor != bs2.m_minor Actual: false Expected: true [ FAILED ] BlockSpecialTest.TwoNamedBlockSpecialObjectBlockDevices (0 ms) [ RUN ] BlockSpecialTest.NamedBlockSpecialObjectBySymlinkMatches test_BlockSpecial.cc:137: Failure Failed get_link_name(): Failed to open directory '/dev/disk/by-path' test_BlockSpecial.cc:168: Failure Failed follow_link_name(): Failed to resolve symbolic link '' test_BlockSpecial.cc:255: Failure Expected: (lnk.m_name.c_str()) != (bs.m_name.c_str()), actual: "" vs "" [ FAILED ] BlockSpecialTest.NamedBlockSpecialObjectBySymlinkMatches (0 ms) [ RUN ] BlockSpecialTest.PreRegisteredCacheUsedBeforeFileSystem [ OK ] BlockSpecialTest.PreRegisteredCacheUsedBeforeFileSystem (0 ms) [ RUN ] BlockSpecialTest.OperatorEqualsTwoEmptyObjects [ OK ] BlockSpecialTest.OperatorEqualsTwoEmptyObjects (0 ms) [ RUN ] BlockSpecialTest.OperatorEqualsSamePlainFiles [ OK ] BlockSpecialTest.OperatorEqualsSamePlainFiles (0 ms) [ RUN ] BlockSpecialTest.OperatorEqualsEmptyObjectAndPlainFile [ OK ] BlockSpecialTest.OperatorEqualsEmptyObjectAndPlainFile (0 ms) [ RUN ] BlockSpecialTest.OperatorEqualsDifferentPlainFiles [ OK ] BlockSpecialTest.OperatorEqualsDifferentPlainFiles (0 ms) [ RUN ] BlockSpecialTest.OperatorEqualsSameBlockDevices [ OK ] BlockSpecialTest.OperatorEqualsSameBlockDevices (0 ms) [ RUN ] BlockSpecialTest.OperatorEqualsEmptyObjectAndBlockDevice [ OK ] BlockSpecialTest.OperatorEqualsEmptyObjectAndBlockDevice (0 ms) [ RUN ] BlockSpecialTest.OperatorEqualsPlainFileAndBlockDevice [ OK ] BlockSpecialTest.OperatorEqualsPlainFileAndBlockDevice (0 ms) [ RUN ] BlockSpecialTest.OperatorEqualsTwoDifferentBlockDevices [ OK ] BlockSpecialTest.OperatorEqualsTwoDifferentBlockDevices (0 ms) [ RUN ] BlockSpecialTest.OperatorEqualsSameBlockDevicesWithMinorZero [ OK ] BlockSpecialTest.OperatorEqualsSameBlockDevicesWithMinorZero (0 ms) [ RUN ] BlockSpecialTest.OperatorLessThanTwoEmptyObjects [ OK ] BlockSpecialTest.OperatorLessThanTwoEmptyObjects (0 ms) [ RUN ] BlockSpecialTest.OperatorLessThanSamePlainFiles [ OK ] BlockSpecialTest.OperatorLessThanSamePlainFiles (0 ms) [ RUN ] BlockSpecialTest.OperatorLessThanDifferentPlainFiles [ OK ] BlockSpecialTest.OperatorLessThanDifferentPlainFiles (0 ms) [ RUN ] BlockSpecialTest.OperatorLessThanEmptyObjectAndPlainFile [ OK ] BlockSpecialTest.OperatorLessThanEmptyObjectAndPlainFile (0 ms) [ RUN ] BlockSpecialTest.OperatorLessThanSameBlockDevices [ OK ] BlockSpecialTest.OperatorLessThanSameBlockDevices (0 ms) [ RUN ] BlockSpecialTest.OperatorLessThanEmptyObjectAndBlockDevice [ OK ] BlockSpecialTest.OperatorLessThanEmptyObjectAndBlockDevice (0 ms) [ RUN ] BlockSpecialTest.OperatorLessThanPlainFileAndBlockDevice [ OK ] BlockSpecialTest.OperatorLessThanPlainFileAndBlockDevice (0 ms) [ RUN ] BlockSpecialTest.OperatorLessThanTwoDifferentBlockDevicesMajorNumbers [ OK ] BlockSpecialTest.OperatorLessThanTwoDifferentBlockDevicesMajorNumbers (0 ms) [ RUN ] BlockSpecialTest.OperatorLessThanTwoDifferentBlockDevicesMinorNumbers [ OK ] BlockSpecialTest.OperatorLessThanTwoDifferentBlockDevicesMinorNumbers (0 ms) [----------] 26 tests from BlockSpecialTest (1 ms total) [----------] Global test environment tear-down [==========] 26 tests from 1 test case ran. (2 ms total) [ PASSED ] 23 tests. [ FAILED ] 3 tests, listed below: [ FAILED ] BlockSpecialTest.NamedBlockSpecialObjectBlockDevice [ FAILED ] BlockSpecialTest.TwoNamedBlockSpecialObjectBlockDevices [ FAILED ] BlockSpecialTest.NamedBlockSpecialObjectBySymlinkMatches 3 FAILED TESTS FAIL test_BlockSpecial (exit status: 1) ============================================================================ Testsuite summary for gparted 0.29.0 ============================================================================ # TOTAL: 3 # PASS: 2 # SKIP: 0 # XFAIL: 0 # FAIL: 1 # XPASS: 0 # ERROR: 0
(In reply to Jeremy Bicha from comment #0) > [ OK ] BlockSpecialTest.NamedBlockSpecialObjectPlainFileDuplicate (0 > ms) > [ RUN ] BlockSpecialTest.NamedBlockSpecialObjectBlockDevice > test_BlockSpecial.cc:214: Failure > Value of: bs.m_major > 0 || bs.m_minor > 0 > Actual: false > Expected: true > [ FAILED ] BlockSpecialTest.NamedBlockSpecialObjectBlockDevice (0 ms) The first failing test is basically saying that the test wasn't able to find any block special device. Both major and minor are 0. https://git.gnome.org/browse/gparted/tree/tests/test_BlockSpecial.cc?h=GPARTED_0_29_0#n206 I am not familiar with sbuild/schroot but I suspect that the build environment doesn't provide any block special devices below /dev. Some are needed for test_BlockSpecial to succeed. See this comment in the code describing what is needed. https://git.gnome.org/browse/gparted/tree/tests/test_BlockSpecial.cc?h=GPARTED_0_29_0#n17 Options are: 1) Add some block devices and symlinks into the build environment so unit tests succeed; 2) Don't run the unit tests in a restricted build environment.
Thank you. I've skipped those tests for now.
Hi Jeremy, Following GNOMEs recent migration to using GitLab we are adding CI (Continuous Integration) and came across a similar issue you encountered and found a solution which you could apply. CI uses Docker images which have limited block devices under /dev which causes one of the BlockSpecial unit tests to fail. We work around this by excluding just the failing test. Exclude unit test which fails in Docker CI image (!4) https://gitlab.gnome.org/mfleetwo/gparted/commit/fe2fc33e67980f0b4a5bba958d257be54715f301 If you want to enable unit testing as part of your build inside sbuild / schroot you could exclude all the BlockSpecial unit tests with: export GTEST_FILTER='-BlockSpecialTest.*' make check Disabling just the failing tests would also be possible. Thanks, Mike