gparted/.gitlab-ci.yml

67 lines
2.0 KiB
YAML
Raw Normal View History

stages:
- build
- test
.centos_image_template: &centos_image_definition
# Use official CentOS image https://hub.docker.com/_/centos/.
image: centos:centos7
before_script:
- yum update -y
- yum install -y which gnome-common yelp-tools glib2-devel intltool
gcc-c++ libuuid-devel parted-devel gtkmm30-devel make
polkit file
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
# Extra packages only needed during the test stage.
Add testing of linux-swap using Value-Parameterised Google Tests (!49) Use Google Test Value-Parameterised to call every test for both ext2 and linux-swap. https://github.com/google/googletest/blob/v1.8.x/googletest/docs/advanced.md#value-parameterized-tests Running the test now looks like this: $ ./test_SupportedFileSystems Running main() from test_SupportedFileSystems.cc [==========] Running 20 tests from 1 test case. [----------] Global test environment set-up. [----------] 20 tests from My/SupportedFileSystemsTest [ RUN ] My/SupportedFileSystemsTest.Create/0 [ OK ] My/SupportedFileSystemsTest.Create/0 (97 ms) [ RUN ] My/SupportedFileSystemsTest.Create/1 [ OK ] My/SupportedFileSystemsTest.Create/1 (15 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndReadUsage/0 [ OK ] My/SupportedFileSystemsTest.CreateAndReadUsage/0 (106 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndReadUsage/1 [ OK ] My/SupportedFileSystemsTest.CreateAndReadUsage/1 (14 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndReadLabel/0 [ OK ] My/SupportedFileSystemsTest.CreateAndReadLabel/0 (95 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndReadLabel/1 [ OK ] My/SupportedFileSystemsTest.CreateAndReadLabel/1 (23 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndReadUUID/0 [ OK ] My/SupportedFileSystemsTest.CreateAndReadUUID/0 (99 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndReadUUID/1 [ OK ] My/SupportedFileSystemsTest.CreateAndReadUUID/1 (22 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndWriteLabel/0 [ OK ] My/SupportedFileSystemsTest.CreateAndWriteLabel/0 (102 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndWriteLabel/1 [ OK ] My/SupportedFileSystemsTest.CreateAndWriteLabel/1 (22 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndWriteUUID/0 [ OK ] My/SupportedFileSystemsTest.CreateAndWriteUUID/0 (101 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndWriteUUID/1 [ OK ] My/SupportedFileSystemsTest.CreateAndWriteUUID/1 (21 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndCheck/0 [ OK ] My/SupportedFileSystemsTest.CreateAndCheck/0 (153 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndCheck/1 test_SupportedFileSystems.cc:424: Skip test. check not supported or support not found [ OK ] My/SupportedFileSystemsTest.CreateAndCheck/1 (0 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndRemove/0 test_SupportedFileSystems.cc:437: Skip test. remove not supported or support not found [ OK ] My/SupportedFileSystemsTest.CreateAndRemove/0 (0 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndRemove/1 test_SupportedFileSystems.cc:437: Skip test. remove not supported or support not found [ OK ] My/SupportedFileSystemsTest.CreateAndRemove/1 (0 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndGrow/0 [ OK ] My/SupportedFileSystemsTest.CreateAndGrow/0 (266 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndGrow/1 [ OK ] My/SupportedFileSystemsTest.CreateAndGrow/1 (32 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndShrink/0 [ OK ] My/SupportedFileSystemsTest.CreateAndShrink/0 (111 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndShrink/1 [ OK ] My/SupportedFileSystemsTest.CreateAndShrink/1 (28 ms) [----------] 20 tests from My/SupportedFileSystemsTest (1311 ms total) [----------] Global test environment tear-down [==========] 20 tests from 1 test case ran. (1342 ms total) [ PASSED ] 20 tests. Closes !49 - Add file system interface tests
2019-08-02 04:15:48 -06:00
- yum install -y e2fsprogs util-linux xorg-x11-server-Xvfb
- cat /etc/os-release
.ubuntu_image_template: &ubuntu_image_definition
# Use official Ubuntu image https://hub.docker.com/_/ubuntu/.
image: ubuntu:latest
before_script:
- apt-get update
- apt-get install -y gnome-common yelp-tools libglib2.0-dev-bin
uuid-dev libparted-dev libgtkmm-3.0-dev make
policykit-1
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
# Extra packages only needed during the test stage.
Add testing of linux-swap using Value-Parameterised Google Tests (!49) Use Google Test Value-Parameterised to call every test for both ext2 and linux-swap. https://github.com/google/googletest/blob/v1.8.x/googletest/docs/advanced.md#value-parameterized-tests Running the test now looks like this: $ ./test_SupportedFileSystems Running main() from test_SupportedFileSystems.cc [==========] Running 20 tests from 1 test case. [----------] Global test environment set-up. [----------] 20 tests from My/SupportedFileSystemsTest [ RUN ] My/SupportedFileSystemsTest.Create/0 [ OK ] My/SupportedFileSystemsTest.Create/0 (97 ms) [ RUN ] My/SupportedFileSystemsTest.Create/1 [ OK ] My/SupportedFileSystemsTest.Create/1 (15 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndReadUsage/0 [ OK ] My/SupportedFileSystemsTest.CreateAndReadUsage/0 (106 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndReadUsage/1 [ OK ] My/SupportedFileSystemsTest.CreateAndReadUsage/1 (14 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndReadLabel/0 [ OK ] My/SupportedFileSystemsTest.CreateAndReadLabel/0 (95 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndReadLabel/1 [ OK ] My/SupportedFileSystemsTest.CreateAndReadLabel/1 (23 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndReadUUID/0 [ OK ] My/SupportedFileSystemsTest.CreateAndReadUUID/0 (99 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndReadUUID/1 [ OK ] My/SupportedFileSystemsTest.CreateAndReadUUID/1 (22 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndWriteLabel/0 [ OK ] My/SupportedFileSystemsTest.CreateAndWriteLabel/0 (102 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndWriteLabel/1 [ OK ] My/SupportedFileSystemsTest.CreateAndWriteLabel/1 (22 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndWriteUUID/0 [ OK ] My/SupportedFileSystemsTest.CreateAndWriteUUID/0 (101 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndWriteUUID/1 [ OK ] My/SupportedFileSystemsTest.CreateAndWriteUUID/1 (21 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndCheck/0 [ OK ] My/SupportedFileSystemsTest.CreateAndCheck/0 (153 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndCheck/1 test_SupportedFileSystems.cc:424: Skip test. check not supported or support not found [ OK ] My/SupportedFileSystemsTest.CreateAndCheck/1 (0 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndRemove/0 test_SupportedFileSystems.cc:437: Skip test. remove not supported or support not found [ OK ] My/SupportedFileSystemsTest.CreateAndRemove/0 (0 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndRemove/1 test_SupportedFileSystems.cc:437: Skip test. remove not supported or support not found [ OK ] My/SupportedFileSystemsTest.CreateAndRemove/1 (0 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndGrow/0 [ OK ] My/SupportedFileSystemsTest.CreateAndGrow/0 (266 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndGrow/1 [ OK ] My/SupportedFileSystemsTest.CreateAndGrow/1 (32 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndShrink/0 [ OK ] My/SupportedFileSystemsTest.CreateAndShrink/0 (111 ms) [ RUN ] My/SupportedFileSystemsTest.CreateAndShrink/1 [ OK ] My/SupportedFileSystemsTest.CreateAndShrink/1 (28 ms) [----------] 20 tests from My/SupportedFileSystemsTest (1311 ms total) [----------] Global test environment tear-down [==========] 20 tests from 1 test case ran. (1342 ms total) [ PASSED ] 20 tests. Closes !49 - Add file system interface tests
2019-08-02 04:15:48 -06:00
- apt-get install -y e2fsprogs util-linux xvfb
- cat /etc/os-release
.build_stage_template: &build_stage_definition
stage: build
script:
- ./autogen.sh
- nproc=`grep -c '^processor' /proc/cpuinfo` || nproc=1
- echo nproc=$nproc
- make -j $nproc
- make install
.test_stage_template: &test_stage_definition
stage: test
script:
- ./autogen.sh
- nproc=`grep -c '^processor' /proc/cpuinfo` || nproc=1
- echo nproc=$nproc
- make -j $nproc
Exclude unit test which fails in Docker CI image (!4) Fragment of the tests/test-suite.log from the Docker CI image showing details of the unit test failure: Running main() from gtest_main.cc [==========] Running 26 tests from 1 test case. [----------] Global test environment set-up. [----------] 26 tests from BlockSpecialTest ... [ RUN ] BlockSpecialTest.NamedBlockSpecialObjectBySymlinkMatches test_BlockSpecial.cc:137: Failure Failed get_link_name(): Failed to open directory '/dev/disk/by-id' 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) ... [==========] 26 tests from 1 test case ran. (1 ms total) [ PASSED ] 25 tests. [ FAILED ] 1 test, listed below: [ FAILED ] BlockSpecialTest.NamedBlockSpecialObjectBySymlinkMatches 1 FAILED TEST So the code is trying to find a symbolic link to a block device to use in the test. It is trying to read the directory /dev/disk/by-id to find a symbolic link, but the directory doesn't exist in the Docker CI image. The used directory was recently changed [1] to use one which existed on all distributions. Docker images don't even have the /dev/disk directory. Exclude just this specific test. [1] 7fe41480749c795dfb79daeba7b058cece2dfdd2 Use /dev/disk/by-id/ to get device symlink in test_BlockSpecial Closes !4 - Add GitLab CI jobs to build and test GParted
2018-06-22 08:27:29 -06:00
# Exclude specific unit test which fails without /dev/disk in Docker images.
- export GTEST_FILTER='-BlockSpecialTest.NamedBlockSpecialObjectBySymlinkMatches'
- make check
- make distcheck
# Check GParted can be built and installed on CentOS and Ubuntu.
centos_build:
<<: *centos_image_definition
<<: *build_stage_definition
ubuntu_build:
<<: *ubuntu_image_definition
<<: *build_stage_definition
# Check GParted unit tests and distcheck pass on CentOS and Ubuntu.
centos_test:
<<: *centos_image_definition
<<: *test_stage_definition
ubuntu_test:
<<: *ubuntu_image_definition
<<: *test_stage_definition