gparted/tests/Makefile.am

108 lines
4.1 KiB
Makefile
Raw Permalink Normal View History

AM_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib/gtest/include \
$(GTEST_CPPFLAGS)
AM_CXXFLAGS = -Wall $(GTEST_CXXFLAGS)
AM_LDFLAGS = $(GTEST_LDFLAGS)
LDADD = \
Fix make distcheck failure from missing libgtest_main.la (#781978) Running 'make distcheck' fails like this: [...] make[3]: Entering directory `[...]/gparted/gparted-0.28.1-git/_build/tests' [...] /bin/sh ../libtool --tag=CXX --mode=link g++ [...] ../../lib/gtest/lib/libgtest_main.la ../../lib/gtest/lib/libgtest.la [...] libtool: link: cannot find the library `../../lib/gtest/lib/libgtest_main.la' or unhandled argument `../../lib/gtest/lib/libgtest_main.la' make[3]: *** [test_dummy] Error 1 make[3]: Leaving directory `[...]/gparted/gparted-0.28.1-git/_build/tests' [...] make[1]: Leaving directory `[...]/gparted/gparted-0.28.1-git/_build' make: *** [distcheck] Error 1 What is happening is that distcheck [1] performs a VPATH build which uses separate read-only source and read-write build trees. Shipped source files, such as .h and .cc, are located in the source tree and the built files, such as .o and .la, are compiled into the build tree. In this case the absolute path to libgtest_main.la is specified using $(top_srcdir) for the source tree, rather than $(top_builddir) for the build tree, hence the cannot find file type error. This error doesn't occur when just performing a 'make check' because that builds in the source tree so $(top_builddir) is the same as $(top_srcdir). Fix by correctly specifying the absolute path to the libgtest*.la files using $(top_builddir). [1] Automake Manual, 14.4 Checking the Distribution https://www.gnu.org/software/automake/manual/automake.html#Checking-the-Distribution Note that for VPATH builds the Automake Manual [2] also recommends using a pair of -I options to specify header files are found in both the build and source trees, something like: AM_CPPFLAGS = -I$(top_builddir)/some/subdir -I$(top_srcdir)/some/subdir This is unnecessary for GParted as all header files are shipped as part of the source archive and no header files are created as part of the build process. Therefore adding -I options specifying $(top_builddir) include directories would just be specifying empty or non-existent include directories in the build tree. [2] Automake Manual, 8.7 Variables used when building a program https://www.gnu.org/software/automake/manual/automake.html#Program-Variables Bug 781978 - Add Google Test C++ test framework
2017-05-10 04:00:59 -06:00
$(GTEST_LIBS) \
$(top_builddir)/lib/gtest/lib/libgtest_main.la \
$(top_builddir)/lib/gtest/lib/libgtest.la
# Programs to be built by "make check"
check_PROGRAMS = \
Add initial unit test of erase_filesystem_signatures() (#220) Initially just testing erasing of Intel Software RAID signatures. Chosen because it was expected to work, but turned out not to be true in all cases. The code needs to initialise GParted_Core::mainthread, construct Gtk::Main() and execute xvfb-run because of this call chain: GParted_Core::erase_filesystem_signatures() GParted_Core::settle_device() Utils::execute_command ("udevadm settle ...") status.foreground = (Glib::Thread::self() == GParted_Core::mainthread) Gtk::Main::run() This was also needed when testing file system interface classes as discussed in commits [1][2]. The test fails like this: $ ./test_EraseFileSystemSignatures ... [ RUN ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDAligned [ OK ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDAligned (155 ms) [ RUN ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDUnaligned test_EraseFileSystemSignatures.cc:286: Failure Failed image_contains_all_zeros(): First non-zero bytes: 0x00001A00 "Intel Raid ISM C" 49 6E 74 65 6C 20 52 61 69 64 20 49 53 4D 20 43 test_EraseFileSystemSignatures.cc:320: Failure Value of: image_contains_all_zeros() Actual: false Expected: true [ FAILED ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDUnaligned (92 ms) Manually write the same test image: $ python << 'EOF' signature = b'Intel Raid ISM Cfg Sig. ' import os fd = os.open('/tmp/test.img', os.O_CREAT|os.O_WRONLY) os.ftruncate(fd, 16*1024*1024 - 512) os.lseek(fd, -(2*512), os.SEEK_END) os.write(fd, signature) os.close(fd) EOF Run gpartedbin /tmp/test.img and Format to > Cleared. GParted continues to display the the image file as containing an ataraid signature. $ blkid /tmp/test.img /tmp/test.img: TYPE="isw_raid_member" $ hexdump -C /tmp/test.img 00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00fffa00 49 6e 74 65 6c 20 52 61 69 64 20 49 53 4d 20 43 |Intel Raid ISM C| 00fffa10 66 67 20 53 69 67 2e 20 00 00 00 00 00 00 00 00 |fg Sig. ........| 00fffa20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00fffe00 This signature is not being cleared when the device/partition/image size is 512 bytes smaller than a whole MiB because the last 3.5 KiB is left unwritten. This is because the last block of zeros written is 8 KiB aligned to 4 KiB at the end of the device. [1] a97c23c57c693b77724970d2f99702d7be18b4bc Add initial create ext2 only FileSystem interface class test (!49) [2] 8db9a83b39b82785dcbcc776ac259aa7986c0955 Run test program under xvfb-run to satisfy need for an X11 display (!49) Closes #220 - Format to Cleared not clearing "pdc" ataraid signature
2023-02-04 08:36:37 -07:00
test_dummy \
test_BlockSpecial \
test_EraseFileSystemSignatures \
test_PasswordRAMStore \
test_PipeCapture \
test_SupportedFileSystems
# Test cases to be run by "make check"
TESTS = $(check_PROGRAMS)
Move duplicated test code into shared modules (#220) Move common testing code which doesn't need linking with GParted objects into the common module. Move the remaining common code used to print GParted objects using the insertion operator (operator<<) into the insertion_operators module. Split the common code like this so that the operator<<(std::ostream&, const OperationDetail&) function is not included in test_PipeCapture and it is not forced to link with all the non-UI related GParted objects. The Automake manual provides guidance that when a header belongs to a single program it is recommended to be listed in the program's _SOURCES variable and for a directory only containing header files listing them in the noinst_HEADERS variable is the right variable to use [1]. However the guidance doesn't cover this case for common.h and insertion_operators.h; header files in a directory with other files and used by multiple programs. So just because we have gparted_core_OBJECTS (normal Makefile, not Automake special variable) listing objects to link with, choose to use noinst_HEADERS Automake variable to list needed headers. [1] GNU Automake manual, 9.2 Header files https://www.gnu.org/software/automake/manual/html_node/Headers.html "Usually, only header files that accompany installed libraries need to be installed. Headers used by programs or convenience libraries are not installed. The noinst_HEADERS variable can be used for such headers. However, when the header belongs to a single convenience library or program, we recommend listing it in the program's or library's _SOURCES variable (see Defining program sources) instead of in noinst_HEADERS. This is clearer for the Makefile.am reader. noinst_HEADERS would be the right variable to use in a directory containing only headers and no associated library or program. All header files must be listed somewhere; in a _SOURCES variable or in a _HEADERS variable. Missing ones will not appear in the distribution. " Closes #220 - Format to Cleared not clearing "pdc" ataraid signature
2023-02-05 04:16:43 -07:00
noinst_HEADERS = \
common.h \
insertion_operators.h
Add initial unit test of erase_filesystem_signatures() (#220) Initially just testing erasing of Intel Software RAID signatures. Chosen because it was expected to work, but turned out not to be true in all cases. The code needs to initialise GParted_Core::mainthread, construct Gtk::Main() and execute xvfb-run because of this call chain: GParted_Core::erase_filesystem_signatures() GParted_Core::settle_device() Utils::execute_command ("udevadm settle ...") status.foreground = (Glib::Thread::self() == GParted_Core::mainthread) Gtk::Main::run() This was also needed when testing file system interface classes as discussed in commits [1][2]. The test fails like this: $ ./test_EraseFileSystemSignatures ... [ RUN ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDAligned [ OK ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDAligned (155 ms) [ RUN ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDUnaligned test_EraseFileSystemSignatures.cc:286: Failure Failed image_contains_all_zeros(): First non-zero bytes: 0x00001A00 "Intel Raid ISM C" 49 6E 74 65 6C 20 52 61 69 64 20 49 53 4D 20 43 test_EraseFileSystemSignatures.cc:320: Failure Value of: image_contains_all_zeros() Actual: false Expected: true [ FAILED ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDUnaligned (92 ms) Manually write the same test image: $ python << 'EOF' signature = b'Intel Raid ISM Cfg Sig. ' import os fd = os.open('/tmp/test.img', os.O_CREAT|os.O_WRONLY) os.ftruncate(fd, 16*1024*1024 - 512) os.lseek(fd, -(2*512), os.SEEK_END) os.write(fd, signature) os.close(fd) EOF Run gpartedbin /tmp/test.img and Format to > Cleared. GParted continues to display the the image file as containing an ataraid signature. $ blkid /tmp/test.img /tmp/test.img: TYPE="isw_raid_member" $ hexdump -C /tmp/test.img 00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00fffa00 49 6e 74 65 6c 20 52 61 69 64 20 49 53 4d 20 43 |Intel Raid ISM C| 00fffa10 66 67 20 53 69 67 2e 20 00 00 00 00 00 00 00 00 |fg Sig. ........| 00fffa20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00fffe00 This signature is not being cleared when the device/partition/image size is 512 bytes smaller than a whole MiB because the last 3.5 KiB is left unwritten. This is because the last block of zeros written is 8 KiB aligned to 4 KiB at the end of the device. [1] a97c23c57c693b77724970d2f99702d7be18b4bc Add initial create ext2 only FileSystem interface class test (!49) [2] 8db9a83b39b82785dcbcc776ac259aa7986c0955 Run test program under xvfb-run to satisfy need for an X11 display (!49) Closes #220 - Format to Cleared not clearing "pdc" ataraid signature
2023-02-04 08:36:37 -07:00
gparted_core_OBJECTS = \
$(top_builddir)/src/BCache_Info.$(OBJEXT) \
Add initial create ext2 only FileSystem interface class test (!49) This is the first step of adding testing of the derived FileSystem interface classes which call the file system specific executables. Rather than mocking command execution and returned output the tests run the real commands, effectively making this integration testing. Test case setup determines the file system supported actions using get_filesystem_support() and individual tests are skipped if a feature is not supported, just as GParted does for it's actions. Each test creates it's own sparse image file and a fresh file system, performs a test on one FileSystem interface call and deletes the image file. This makes each test independent and allows them to run as a non-root user, provided the file system command itself doesn't require root. Errors reported for a failed interface call will include the GParted OperationDetails, which in turn includes the file system specific command used and stdout and stderr from it's execution. For example, temporarily breaking the test code to create a 10 KiB image file instead of 256 MiB one produces this: $ ./test_ext2 Running main() from test_ext2.cc [==========] Running 1 test from 1 test case. [----------] Global test environment set-up. [----------] 1 test from ext2Test [ RUN ] ext2Test.Create test_ext2.cc:199: Failure Value of: s_ext2_obj->create(m_partition, m_operation_detail) Actual: false Expected: true Operation details: <b><i>mkfs.ext2 -F -L &apos;&apos; &apos;/home/centos/programming/c/gparted/tests/test_ext2.img&apos;</i></b> 00:00:00 (ERROR) <i></i> <i>mke2fs 1.42.9 (28-Dec-2013) /home/centos/programming/c/gparted/tests/test_ext2.img: Not enough space to build proposed filesystem while setting up superblock </i> [ FAILED ] ext2Test.Create (25 ms) [----------] 1 test from ext2Test (25 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test case ran. (30 ms total) [ PASSED ] 0 tests. [ FAILED ] 1 test, listed below: [ FAILED ] ext2Test.Create 1 FAILED TEST $ echo $? 1 Also as Utils:: and FileSystem::execute_command() are needed, this requires linking with GParted_Core for GParted_Core::mainthread and therefore with most of the non-UI classes in gpartedbin. Closes !49 - Add file system interface tests
2019-07-17 06:08:08 -06:00
$(top_builddir)/src/BlockSpecial.$(OBJEXT) \
$(top_builddir)/src/CopyBlocks.$(OBJEXT) \
$(top_builddir)/src/DMRaid.$(OBJEXT) \
$(top_builddir)/src/Device.$(OBJEXT) \
$(top_builddir)/src/FS_Info.$(OBJEXT) \
$(top_builddir)/src/FileSystem.$(OBJEXT) \
$(top_builddir)/src/GParted_Core.$(OBJEXT) \
$(top_builddir)/src/LUKS_Info.$(OBJEXT) \
$(top_builddir)/src/LVM2_PV_Info.$(OBJEXT) \
$(top_builddir)/src/Mount_Info.$(OBJEXT) \
$(top_builddir)/src/Operation.$(OBJEXT) \
$(top_builddir)/src/OperationCopy.$(OBJEXT) \
$(top_builddir)/src/OperationDetail.$(OBJEXT) \
$(top_builddir)/src/Partition.$(OBJEXT) \
$(top_builddir)/src/PartitionLUKS.$(OBJEXT) \
$(top_builddir)/src/PartitionVector.$(OBJEXT) \
$(top_builddir)/src/PasswordRAMStore.$(OBJEXT) \
Add initial create ext2 only FileSystem interface class test (!49) This is the first step of adding testing of the derived FileSystem interface classes which call the file system specific executables. Rather than mocking command execution and returned output the tests run the real commands, effectively making this integration testing. Test case setup determines the file system supported actions using get_filesystem_support() and individual tests are skipped if a feature is not supported, just as GParted does for it's actions. Each test creates it's own sparse image file and a fresh file system, performs a test on one FileSystem interface call and deletes the image file. This makes each test independent and allows them to run as a non-root user, provided the file system command itself doesn't require root. Errors reported for a failed interface call will include the GParted OperationDetails, which in turn includes the file system specific command used and stdout and stderr from it's execution. For example, temporarily breaking the test code to create a 10 KiB image file instead of 256 MiB one produces this: $ ./test_ext2 Running main() from test_ext2.cc [==========] Running 1 test from 1 test case. [----------] Global test environment set-up. [----------] 1 test from ext2Test [ RUN ] ext2Test.Create test_ext2.cc:199: Failure Value of: s_ext2_obj->create(m_partition, m_operation_detail) Actual: false Expected: true Operation details: <b><i>mkfs.ext2 -F -L &apos;&apos; &apos;/home/centos/programming/c/gparted/tests/test_ext2.img&apos;</i></b> 00:00:00 (ERROR) <i></i> <i>mke2fs 1.42.9 (28-Dec-2013) /home/centos/programming/c/gparted/tests/test_ext2.img: Not enough space to build proposed filesystem while setting up superblock </i> [ FAILED ] ext2Test.Create (25 ms) [----------] 1 test from ext2Test (25 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test case ran. (30 ms total) [ PASSED ] 0 tests. [ FAILED ] 1 test, listed below: [ FAILED ] ext2Test.Create 1 FAILED TEST $ echo $? 1 Also as Utils:: and FileSystem::execute_command() are needed, this requires linking with GParted_Core for GParted_Core::mainthread and therefore with most of the non-UI classes in gpartedbin. Closes !49 - Add file system interface tests
2019-07-17 06:08:08 -06:00
$(top_builddir)/src/PipeCapture.$(OBJEXT) \
$(top_builddir)/src/Proc_Partitions_Info.$(OBJEXT) \
$(top_builddir)/src/ProgressBar.$(OBJEXT) \
$(top_builddir)/src/SupportedFileSystems.$(OBJEXT) \
Add initial create ext2 only FileSystem interface class test (!49) This is the first step of adding testing of the derived FileSystem interface classes which call the file system specific executables. Rather than mocking command execution and returned output the tests run the real commands, effectively making this integration testing. Test case setup determines the file system supported actions using get_filesystem_support() and individual tests are skipped if a feature is not supported, just as GParted does for it's actions. Each test creates it's own sparse image file and a fresh file system, performs a test on one FileSystem interface call and deletes the image file. This makes each test independent and allows them to run as a non-root user, provided the file system command itself doesn't require root. Errors reported for a failed interface call will include the GParted OperationDetails, which in turn includes the file system specific command used and stdout and stderr from it's execution. For example, temporarily breaking the test code to create a 10 KiB image file instead of 256 MiB one produces this: $ ./test_ext2 Running main() from test_ext2.cc [==========] Running 1 test from 1 test case. [----------] Global test environment set-up. [----------] 1 test from ext2Test [ RUN ] ext2Test.Create test_ext2.cc:199: Failure Value of: s_ext2_obj->create(m_partition, m_operation_detail) Actual: false Expected: true Operation details: <b><i>mkfs.ext2 -F -L &apos;&apos; &apos;/home/centos/programming/c/gparted/tests/test_ext2.img&apos;</i></b> 00:00:00 (ERROR) <i></i> <i>mke2fs 1.42.9 (28-Dec-2013) /home/centos/programming/c/gparted/tests/test_ext2.img: Not enough space to build proposed filesystem while setting up superblock </i> [ FAILED ] ext2Test.Create (25 ms) [----------] 1 test from ext2Test (25 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test case ran. (30 ms total) [ PASSED ] 0 tests. [ FAILED ] 1 test, listed below: [ FAILED ] ext2Test.Create 1 FAILED TEST $ echo $? 1 Also as Utils:: and FileSystem::execute_command() are needed, this requires linking with GParted_Core for GParted_Core::mainthread and therefore with most of the non-UI classes in gpartedbin. Closes !49 - Add file system interface tests
2019-07-17 06:08:08 -06:00
$(top_builddir)/src/SWRaid_Info.$(OBJEXT) \
$(top_builddir)/src/Utils.$(OBJEXT) \
$(top_builddir)/src/btrfs.$(OBJEXT) \
$(top_builddir)/src/exfat.$(OBJEXT) \
$(top_builddir)/src/ext2.$(OBJEXT) \
$(top_builddir)/src/f2fs.$(OBJEXT) \
$(top_builddir)/src/fat16.$(OBJEXT) \
$(top_builddir)/src/hfs.$(OBJEXT) \
$(top_builddir)/src/hfsplus.$(OBJEXT) \
$(top_builddir)/src/jfs.$(OBJEXT) \
$(top_builddir)/src/linux_swap.$(OBJEXT) \
$(top_builddir)/src/luks.$(OBJEXT) \
$(top_builddir)/src/lvm2_pv.$(OBJEXT) \
$(top_builddir)/src/minix.$(OBJEXT) \
$(top_builddir)/src/nilfs2.$(OBJEXT) \
$(top_builddir)/src/ntfs.$(OBJEXT) \
$(top_builddir)/src/reiser4.$(OBJEXT) \
$(top_builddir)/src/reiserfs.$(OBJEXT) \
$(top_builddir)/src/udf.$(OBJEXT) \
Add initial unit test of erase_filesystem_signatures() (#220) Initially just testing erasing of Intel Software RAID signatures. Chosen because it was expected to work, but turned out not to be true in all cases. The code needs to initialise GParted_Core::mainthread, construct Gtk::Main() and execute xvfb-run because of this call chain: GParted_Core::erase_filesystem_signatures() GParted_Core::settle_device() Utils::execute_command ("udevadm settle ...") status.foreground = (Glib::Thread::self() == GParted_Core::mainthread) Gtk::Main::run() This was also needed when testing file system interface classes as discussed in commits [1][2]. The test fails like this: $ ./test_EraseFileSystemSignatures ... [ RUN ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDAligned [ OK ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDAligned (155 ms) [ RUN ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDUnaligned test_EraseFileSystemSignatures.cc:286: Failure Failed image_contains_all_zeros(): First non-zero bytes: 0x00001A00 "Intel Raid ISM C" 49 6E 74 65 6C 20 52 61 69 64 20 49 53 4D 20 43 test_EraseFileSystemSignatures.cc:320: Failure Value of: image_contains_all_zeros() Actual: false Expected: true [ FAILED ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDUnaligned (92 ms) Manually write the same test image: $ python << 'EOF' signature = b'Intel Raid ISM Cfg Sig. ' import os fd = os.open('/tmp/test.img', os.O_CREAT|os.O_WRONLY) os.ftruncate(fd, 16*1024*1024 - 512) os.lseek(fd, -(2*512), os.SEEK_END) os.write(fd, signature) os.close(fd) EOF Run gpartedbin /tmp/test.img and Format to > Cleared. GParted continues to display the the image file as containing an ataraid signature. $ blkid /tmp/test.img /tmp/test.img: TYPE="isw_raid_member" $ hexdump -C /tmp/test.img 00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00fffa00 49 6e 74 65 6c 20 52 61 69 64 20 49 53 4d 20 43 |Intel Raid ISM C| 00fffa10 66 67 20 53 69 67 2e 20 00 00 00 00 00 00 00 00 |fg Sig. ........| 00fffa20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00fffe00 This signature is not being cleared when the device/partition/image size is 512 bytes smaller than a whole MiB because the last 3.5 KiB is left unwritten. This is because the last block of zeros written is 8 KiB aligned to 4 KiB at the end of the device. [1] a97c23c57c693b77724970d2f99702d7be18b4bc Add initial create ext2 only FileSystem interface class test (!49) [2] 8db9a83b39b82785dcbcc776ac259aa7986c0955 Run test program under xvfb-run to satisfy need for an X11 display (!49) Closes #220 - Format to Cleared not clearing "pdc" ataraid signature
2023-02-04 08:36:37 -07:00
$(top_builddir)/src/xfs.$(OBJEXT)
test_dummy_SOURCES = test_dummy.cc
Add initial create ext2 only FileSystem interface class test (!49) This is the first step of adding testing of the derived FileSystem interface classes which call the file system specific executables. Rather than mocking command execution and returned output the tests run the real commands, effectively making this integration testing. Test case setup determines the file system supported actions using get_filesystem_support() and individual tests are skipped if a feature is not supported, just as GParted does for it's actions. Each test creates it's own sparse image file and a fresh file system, performs a test on one FileSystem interface call and deletes the image file. This makes each test independent and allows them to run as a non-root user, provided the file system command itself doesn't require root. Errors reported for a failed interface call will include the GParted OperationDetails, which in turn includes the file system specific command used and stdout and stderr from it's execution. For example, temporarily breaking the test code to create a 10 KiB image file instead of 256 MiB one produces this: $ ./test_ext2 Running main() from test_ext2.cc [==========] Running 1 test from 1 test case. [----------] Global test environment set-up. [----------] 1 test from ext2Test [ RUN ] ext2Test.Create test_ext2.cc:199: Failure Value of: s_ext2_obj->create(m_partition, m_operation_detail) Actual: false Expected: true Operation details: <b><i>mkfs.ext2 -F -L &apos;&apos; &apos;/home/centos/programming/c/gparted/tests/test_ext2.img&apos;</i></b> 00:00:00 (ERROR) <i></i> <i>mke2fs 1.42.9 (28-Dec-2013) /home/centos/programming/c/gparted/tests/test_ext2.img: Not enough space to build proposed filesystem while setting up superblock </i> [ FAILED ] ext2Test.Create (25 ms) [----------] 1 test from ext2Test (25 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test case ran. (30 ms total) [ PASSED ] 0 tests. [ FAILED ] 1 test, listed below: [ FAILED ] ext2Test.Create 1 FAILED TEST $ echo $? 1 Also as Utils:: and FileSystem::execute_command() are needed, this requires linking with GParted_Core for GParted_Core::mainthread and therefore with most of the non-UI classes in gpartedbin. Closes !49 - Add file system interface tests
2019-07-17 06:08:08 -06:00
Fix make distcheck build failing with missing *.Po files (#785308) Make distcheck is failing like: <snip> Make distcheck Making distclean in tests make[2]: Entering directory '/home/gedakc/workspace/gparted/gparted-0.29.0-beta1/_build/sub/tests' Makefile:658: ../src/.deps/BlockSpecial.Po: No such file or directory Makefile:659: ../src/.deps/PipeCapture.Po: No such file or directory make[2]: *** No rule to make target '../src/.deps/PipeCapture.Po'. Stop. make[2]: Leaving directory '/home/gedakc/workspace/gparted/gparted-0.29.0-beta1/_build/sub/tests' Makefile:596: recipe for target 'distclean-recursive' failed make[1]: *** [distclean-recursive] Error 1 make[1]: Leaving directory '/home/gedakc/workspace/gparted/gparted-0.29.0-beta1/_build/sub' Makefile:805: recipe for target 'distcheck' failed make: *** [distcheck] Error 1 Make distcheck started failing like this with this commit: f31808989ab7562ad411911c8b2dc16958708be8 Silence subdir-objects warning from automake 1.14 (#781978) However, also need to be referring to source files from a sibling directory like this from tests/Makefile.am: test_BlockSpecial_SOURCES = test_BlockSpecial.cc ../src/BlockSpecial.cc ^^^^^^^ First introduced by this commit: c37be28148ec6c6b2b9be4cf097f4d20513c9a14 Add unit tests for BlockSpecial constructors and internal caching (#781978) This failure, if not exactly common, has been seen a number of times before. Using this hint from a GNU Automake forum post: converting to subdir-objects http://gnu-automake.7480.n7.nabble.com/converting-to-subdir-objects-td21724.html "I had the same issue and wouldn't care unless Automake 1.15 started to warn about "source file in a subdirectory". In my case 'bar.o' is also built from 'foo/Makefile' so I decided to skip using 'bar.c' as SOURCE and instead link in 'foo/bar.o'. http://dev.thep.lu.se/svndigest/changeset/1581 Cheers, Peter " Fix by avoiding referring to source files from a sibling directory when building the unit test programs, instead refer to object files instead. Note that the automake subdir-objects option is still required to silence the warning because of the use of source files in subdirectories by lib/gtest/Makefile.am. Bug 785308 - make distcheck fails with *.Po: No such file or directory
2017-07-23 04:08:39 -06:00
test_BlockSpecial_SOURCES = test_BlockSpecial.cc
test_BlockSpecial_LDADD = \
$(top_builddir)/src/BlockSpecial.$(OBJEXT) \
$(LDADD)
Move duplicated test code into shared modules (#220) Move common testing code which doesn't need linking with GParted objects into the common module. Move the remaining common code used to print GParted objects using the insertion operator (operator<<) into the insertion_operators module. Split the common code like this so that the operator<<(std::ostream&, const OperationDetail&) function is not included in test_PipeCapture and it is not forced to link with all the non-UI related GParted objects. The Automake manual provides guidance that when a header belongs to a single program it is recommended to be listed in the program's _SOURCES variable and for a directory only containing header files listing them in the noinst_HEADERS variable is the right variable to use [1]. However the guidance doesn't cover this case for common.h and insertion_operators.h; header files in a directory with other files and used by multiple programs. So just because we have gparted_core_OBJECTS (normal Makefile, not Automake special variable) listing objects to link with, choose to use noinst_HEADERS Automake variable to list needed headers. [1] GNU Automake manual, 9.2 Header files https://www.gnu.org/software/automake/manual/html_node/Headers.html "Usually, only header files that accompany installed libraries need to be installed. Headers used by programs or convenience libraries are not installed. The noinst_HEADERS variable can be used for such headers. However, when the header belongs to a single convenience library or program, we recommend listing it in the program's or library's _SOURCES variable (see Defining program sources) instead of in noinst_HEADERS. This is clearer for the Makefile.am reader. noinst_HEADERS would be the right variable to use in a directory containing only headers and no associated library or program. All header files must be listed somewhere; in a _SOURCES variable or in a _HEADERS variable. Missing ones will not appear in the distribution. " Closes #220 - Format to Cleared not clearing "pdc" ataraid signature
2023-02-05 04:16:43 -07:00
test_EraseFileSystemSignatures_SOURCES = \
test_EraseFileSystemSignatures.cc \
common.cc \
insertion_operators.cc
Add initial unit test of erase_filesystem_signatures() (#220) Initially just testing erasing of Intel Software RAID signatures. Chosen because it was expected to work, but turned out not to be true in all cases. The code needs to initialise GParted_Core::mainthread, construct Gtk::Main() and execute xvfb-run because of this call chain: GParted_Core::erase_filesystem_signatures() GParted_Core::settle_device() Utils::execute_command ("udevadm settle ...") status.foreground = (Glib::Thread::self() == GParted_Core::mainthread) Gtk::Main::run() This was also needed when testing file system interface classes as discussed in commits [1][2]. The test fails like this: $ ./test_EraseFileSystemSignatures ... [ RUN ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDAligned [ OK ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDAligned (155 ms) [ RUN ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDUnaligned test_EraseFileSystemSignatures.cc:286: Failure Failed image_contains_all_zeros(): First non-zero bytes: 0x00001A00 "Intel Raid ISM C" 49 6E 74 65 6C 20 52 61 69 64 20 49 53 4D 20 43 test_EraseFileSystemSignatures.cc:320: Failure Value of: image_contains_all_zeros() Actual: false Expected: true [ FAILED ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDUnaligned (92 ms) Manually write the same test image: $ python << 'EOF' signature = b'Intel Raid ISM Cfg Sig. ' import os fd = os.open('/tmp/test.img', os.O_CREAT|os.O_WRONLY) os.ftruncate(fd, 16*1024*1024 - 512) os.lseek(fd, -(2*512), os.SEEK_END) os.write(fd, signature) os.close(fd) EOF Run gpartedbin /tmp/test.img and Format to > Cleared. GParted continues to display the the image file as containing an ataraid signature. $ blkid /tmp/test.img /tmp/test.img: TYPE="isw_raid_member" $ hexdump -C /tmp/test.img 00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00fffa00 49 6e 74 65 6c 20 52 61 69 64 20 49 53 4d 20 43 |Intel Raid ISM C| 00fffa10 66 67 20 53 69 67 2e 20 00 00 00 00 00 00 00 00 |fg Sig. ........| 00fffa20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00fffe00 This signature is not being cleared when the device/partition/image size is 512 bytes smaller than a whole MiB because the last 3.5 KiB is left unwritten. This is because the last block of zeros written is 8 KiB aligned to 4 KiB at the end of the device. [1] a97c23c57c693b77724970d2f99702d7be18b4bc Add initial create ext2 only FileSystem interface class test (!49) [2] 8db9a83b39b82785dcbcc776ac259aa7986c0955 Run test program under xvfb-run to satisfy need for an X11 display (!49) Closes #220 - Format to Cleared not clearing "pdc" ataraid signature
2023-02-04 08:36:37 -07:00
test_EraseFileSystemSignatures_LDADD = \
$(gparted_core_OBJECTS) \
$(GTEST_LIBS) \
$(top_builddir)/lib/gtest/lib/libgtest.la
test_PasswordRAMStore_SOURCES = test_PasswordRAMStore.cc
test_PasswordRAMStore_LDADD = \
$(top_builddir)/src/PasswordRAMStore.$(OBJEXT) \
$(LDADD)
Move duplicated test code into shared modules (#220) Move common testing code which doesn't need linking with GParted objects into the common module. Move the remaining common code used to print GParted objects using the insertion operator (operator<<) into the insertion_operators module. Split the common code like this so that the operator<<(std::ostream&, const OperationDetail&) function is not included in test_PipeCapture and it is not forced to link with all the non-UI related GParted objects. The Automake manual provides guidance that when a header belongs to a single program it is recommended to be listed in the program's _SOURCES variable and for a directory only containing header files listing them in the noinst_HEADERS variable is the right variable to use [1]. However the guidance doesn't cover this case for common.h and insertion_operators.h; header files in a directory with other files and used by multiple programs. So just because we have gparted_core_OBJECTS (normal Makefile, not Automake special variable) listing objects to link with, choose to use noinst_HEADERS Automake variable to list needed headers. [1] GNU Automake manual, 9.2 Header files https://www.gnu.org/software/automake/manual/html_node/Headers.html "Usually, only header files that accompany installed libraries need to be installed. Headers used by programs or convenience libraries are not installed. The noinst_HEADERS variable can be used for such headers. However, when the header belongs to a single convenience library or program, we recommend listing it in the program's or library's _SOURCES variable (see Defining program sources) instead of in noinst_HEADERS. This is clearer for the Makefile.am reader. noinst_HEADERS would be the right variable to use in a directory containing only headers and no associated library or program. All header files must be listed somewhere; in a _SOURCES variable or in a _HEADERS variable. Missing ones will not appear in the distribution. " Closes #220 - Format to Cleared not clearing "pdc" ataraid signature
2023-02-05 04:16:43 -07:00
test_PipeCapture_SOURCES = \
test_PipeCapture.cc \
common.cc
Fix make distcheck build failing with missing *.Po files (#785308) Make distcheck is failing like: <snip> Make distcheck Making distclean in tests make[2]: Entering directory '/home/gedakc/workspace/gparted/gparted-0.29.0-beta1/_build/sub/tests' Makefile:658: ../src/.deps/BlockSpecial.Po: No such file or directory Makefile:659: ../src/.deps/PipeCapture.Po: No such file or directory make[2]: *** No rule to make target '../src/.deps/PipeCapture.Po'. Stop. make[2]: Leaving directory '/home/gedakc/workspace/gparted/gparted-0.29.0-beta1/_build/sub/tests' Makefile:596: recipe for target 'distclean-recursive' failed make[1]: *** [distclean-recursive] Error 1 make[1]: Leaving directory '/home/gedakc/workspace/gparted/gparted-0.29.0-beta1/_build/sub' Makefile:805: recipe for target 'distcheck' failed make: *** [distcheck] Error 1 Make distcheck started failing like this with this commit: f31808989ab7562ad411911c8b2dc16958708be8 Silence subdir-objects warning from automake 1.14 (#781978) However, also need to be referring to source files from a sibling directory like this from tests/Makefile.am: test_BlockSpecial_SOURCES = test_BlockSpecial.cc ../src/BlockSpecial.cc ^^^^^^^ First introduced by this commit: c37be28148ec6c6b2b9be4cf097f4d20513c9a14 Add unit tests for BlockSpecial constructors and internal caching (#781978) This failure, if not exactly common, has been seen a number of times before. Using this hint from a GNU Automake forum post: converting to subdir-objects http://gnu-automake.7480.n7.nabble.com/converting-to-subdir-objects-td21724.html "I had the same issue and wouldn't care unless Automake 1.15 started to warn about "source file in a subdirectory". In my case 'bar.o' is also built from 'foo/Makefile' so I decided to skip using 'bar.c' as SOURCE and instead link in 'foo/bar.o'. http://dev.thep.lu.se/svndigest/changeset/1581 Cheers, Peter " Fix by avoiding referring to source files from a sibling directory when building the unit test programs, instead refer to object files instead. Note that the automake subdir-objects option is still required to silence the warning because of the use of source files in subdirectories by lib/gtest/Makefile.am. Bug 785308 - make distcheck fails with *.Po: No such file or directory
2017-07-23 04:08:39 -06:00
test_PipeCapture_LDADD = \
$(top_builddir)/src/PipeCapture.$(OBJEXT) \
$(LDADD)
Add initial unit test of erase_filesystem_signatures() (#220) Initially just testing erasing of Intel Software RAID signatures. Chosen because it was expected to work, but turned out not to be true in all cases. The code needs to initialise GParted_Core::mainthread, construct Gtk::Main() and execute xvfb-run because of this call chain: GParted_Core::erase_filesystem_signatures() GParted_Core::settle_device() Utils::execute_command ("udevadm settle ...") status.foreground = (Glib::Thread::self() == GParted_Core::mainthread) Gtk::Main::run() This was also needed when testing file system interface classes as discussed in commits [1][2]. The test fails like this: $ ./test_EraseFileSystemSignatures ... [ RUN ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDAligned [ OK ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDAligned (155 ms) [ RUN ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDUnaligned test_EraseFileSystemSignatures.cc:286: Failure Failed image_contains_all_zeros(): First non-zero bytes: 0x00001A00 "Intel Raid ISM C" 49 6E 74 65 6C 20 52 61 69 64 20 49 53 4D 20 43 test_EraseFileSystemSignatures.cc:320: Failure Value of: image_contains_all_zeros() Actual: false Expected: true [ FAILED ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDUnaligned (92 ms) Manually write the same test image: $ python << 'EOF' signature = b'Intel Raid ISM Cfg Sig. ' import os fd = os.open('/tmp/test.img', os.O_CREAT|os.O_WRONLY) os.ftruncate(fd, 16*1024*1024 - 512) os.lseek(fd, -(2*512), os.SEEK_END) os.write(fd, signature) os.close(fd) EOF Run gpartedbin /tmp/test.img and Format to > Cleared. GParted continues to display the the image file as containing an ataraid signature. $ blkid /tmp/test.img /tmp/test.img: TYPE="isw_raid_member" $ hexdump -C /tmp/test.img 00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00fffa00 49 6e 74 65 6c 20 52 61 69 64 20 49 53 4d 20 43 |Intel Raid ISM C| 00fffa10 66 67 20 53 69 67 2e 20 00 00 00 00 00 00 00 00 |fg Sig. ........| 00fffa20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00fffe00 This signature is not being cleared when the device/partition/image size is 512 bytes smaller than a whole MiB because the last 3.5 KiB is left unwritten. This is because the last block of zeros written is 8 KiB aligned to 4 KiB at the end of the device. [1] a97c23c57c693b77724970d2f99702d7be18b4bc Add initial create ext2 only FileSystem interface class test (!49) [2] 8db9a83b39b82785dcbcc776ac259aa7986c0955 Run test program under xvfb-run to satisfy need for an X11 display (!49) Closes #220 - Format to Cleared not clearing "pdc" ataraid signature
2023-02-04 08:36:37 -07:00
Move duplicated test code into shared modules (#220) Move common testing code which doesn't need linking with GParted objects into the common module. Move the remaining common code used to print GParted objects using the insertion operator (operator<<) into the insertion_operators module. Split the common code like this so that the operator<<(std::ostream&, const OperationDetail&) function is not included in test_PipeCapture and it is not forced to link with all the non-UI related GParted objects. The Automake manual provides guidance that when a header belongs to a single program it is recommended to be listed in the program's _SOURCES variable and for a directory only containing header files listing them in the noinst_HEADERS variable is the right variable to use [1]. However the guidance doesn't cover this case for common.h and insertion_operators.h; header files in a directory with other files and used by multiple programs. So just because we have gparted_core_OBJECTS (normal Makefile, not Automake special variable) listing objects to link with, choose to use noinst_HEADERS Automake variable to list needed headers. [1] GNU Automake manual, 9.2 Header files https://www.gnu.org/software/automake/manual/html_node/Headers.html "Usually, only header files that accompany installed libraries need to be installed. Headers used by programs or convenience libraries are not installed. The noinst_HEADERS variable can be used for such headers. However, when the header belongs to a single convenience library or program, we recommend listing it in the program's or library's _SOURCES variable (see Defining program sources) instead of in noinst_HEADERS. This is clearer for the Makefile.am reader. noinst_HEADERS would be the right variable to use in a directory containing only headers and no associated library or program. All header files must be listed somewhere; in a _SOURCES variable or in a _HEADERS variable. Missing ones will not appear in the distribution. " Closes #220 - Format to Cleared not clearing "pdc" ataraid signature
2023-02-05 04:16:43 -07:00
test_SupportedFileSystems_SOURCES = \
test_SupportedFileSystems.cc \
common.cc \
insertion_operators.cc
Add initial unit test of erase_filesystem_signatures() (#220) Initially just testing erasing of Intel Software RAID signatures. Chosen because it was expected to work, but turned out not to be true in all cases. The code needs to initialise GParted_Core::mainthread, construct Gtk::Main() and execute xvfb-run because of this call chain: GParted_Core::erase_filesystem_signatures() GParted_Core::settle_device() Utils::execute_command ("udevadm settle ...") status.foreground = (Glib::Thread::self() == GParted_Core::mainthread) Gtk::Main::run() This was also needed when testing file system interface classes as discussed in commits [1][2]. The test fails like this: $ ./test_EraseFileSystemSignatures ... [ RUN ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDAligned [ OK ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDAligned (155 ms) [ RUN ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDUnaligned test_EraseFileSystemSignatures.cc:286: Failure Failed image_contains_all_zeros(): First non-zero bytes: 0x00001A00 "Intel Raid ISM C" 49 6E 74 65 6C 20 52 61 69 64 20 49 53 4D 20 43 test_EraseFileSystemSignatures.cc:320: Failure Value of: image_contains_all_zeros() Actual: false Expected: true [ FAILED ] EraseFileSystemSignaturesTest.IntelSoftwareRAIDUnaligned (92 ms) Manually write the same test image: $ python << 'EOF' signature = b'Intel Raid ISM Cfg Sig. ' import os fd = os.open('/tmp/test.img', os.O_CREAT|os.O_WRONLY) os.ftruncate(fd, 16*1024*1024 - 512) os.lseek(fd, -(2*512), os.SEEK_END) os.write(fd, signature) os.close(fd) EOF Run gpartedbin /tmp/test.img and Format to > Cleared. GParted continues to display the the image file as containing an ataraid signature. $ blkid /tmp/test.img /tmp/test.img: TYPE="isw_raid_member" $ hexdump -C /tmp/test.img 00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00fffa00 49 6e 74 65 6c 20 52 61 69 64 20 49 53 4d 20 43 |Intel Raid ISM C| 00fffa10 66 67 20 53 69 67 2e 20 00 00 00 00 00 00 00 00 |fg Sig. ........| 00fffa20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00fffe00 This signature is not being cleared when the device/partition/image size is 512 bytes smaller than a whole MiB because the last 3.5 KiB is left unwritten. This is because the last block of zeros written is 8 KiB aligned to 4 KiB at the end of the device. [1] a97c23c57c693b77724970d2f99702d7be18b4bc Add initial create ext2 only FileSystem interface class test (!49) [2] 8db9a83b39b82785dcbcc776ac259aa7986c0955 Run test program under xvfb-run to satisfy need for an X11 display (!49) Closes #220 - Format to Cleared not clearing "pdc" ataraid signature
2023-02-04 08:36:37 -07:00
test_SupportedFileSystems_LDADD = \
$(gparted_core_OBJECTS) \
$(GTEST_LIBS) \
$(top_builddir)/lib/gtest/lib/libgtest.la