mirror of
https://gitlab.gnome.org/GNOME/gparted
synced 2024-07-18 19:23:41 +00:00
![Mike Fleetwood](/assets/img/avatar_default.png)
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 '' '/home/centos/programming/c/gparted/tests/test_ext2.img'</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
60 lines
809 B
Plaintext
60 lines
809 B
Plaintext
# List of file patterns for git to ignore.
|
|
#
|
|
# Please try to keep entries in alphabetical order :-)
|
|
#
|
|
*~
|
|
*.a
|
|
*.gmo
|
|
*.lo
|
|
*.mo
|
|
*.o
|
|
*.stamp
|
|
.cproject
|
|
.csettings
|
|
.deps
|
|
.dirstamp
|
|
.intltool-merge-cache
|
|
.libs
|
|
.project
|
|
.xml2po.mo
|
|
INSTALL
|
|
Makefile
|
|
Makefile.in
|
|
Makefile.in.in
|
|
POTFILES
|
|
aclocal.m4
|
|
autom4te.cache
|
|
compile
|
|
config.*
|
|
configure
|
|
depcomp
|
|
gparted
|
|
gparted.appdata.xml
|
|
gparted.desktop
|
|
gparted.desktop.in
|
|
gpartedbin
|
|
index.docbook
|
|
install-sh
|
|
intltool-*
|
|
lib/gtest/lib
|
|
libtool
|
|
ltmain.sh
|
|
m4/*.m4
|
|
!m4/ax_cxx_compile_stdcxx_11.m4
|
|
!m4/ax_cxx_compile_stdcxx.m4
|
|
missing
|
|
mkinstalldirs
|
|
org.gnome.gparted.policy
|
|
org.gnome.gparted.policy.in
|
|
stamp-*
|
|
test-driver
|
|
testbuild.log
|
|
tests/*.log
|
|
tests/*.trs
|
|
tests/test-suite.log
|
|
tests/test_BlockSpecial
|
|
tests/test_PasswordRAMStore
|
|
tests/test_PipeCapture
|
|
tests/test_dummy
|
|
tests/test_ext2
|