diff --git a/.github/tools/run_mdadm_tests.sh b/.github/tools/run_mdadm_tests.sh new file mode 100755 index 00000000..a4513a46 --- /dev/null +++ b/.github/tools/run_mdadm_tests.sh @@ -0,0 +1,9 @@ +#!/usr/bin/bash + +sudo make clean +sudo make -j$(nproc) +sudo make install +sudo mdadm -Ss +sudo ./test setup +sudo ./test --skip-broken --no-error --disable-integrity --disable-multipath --disable-linear --keep-going +sudo ./test cleanup \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..59601947 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,41 @@ +name: review +on: + pull_request: + paths: + - '*.c' + - '*.h' +jobs: + upstream_tests: + if: ${{ github.repository == 'md-raid-utilities/mdadm' }} + runs-on: self-hosted + timeout-minutes: 90 + name: upstream tests + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + - name: 'Prepare machine' + run: | + cd .. + vagrant halt + vagrant status + vagrant up + - name: 'Run tests' + run: | + cd .. + vagrant ssh -c "cd /home/vagrant/host/mdadm && .github/tools/run_mdadm_tests.sh" + - uses: actions/download-artifact@v4 + with: + name: /var/tmp/*.log + cleanup: + runs-on: self-hosted + steps: + - name: Restore clean VM + run: | + cd .. + vagrant halt + - name: Stop md devices + run: sudo mdadm -Ss + - name: Clean logs + run: rm -rf /var/tmp/*.log diff --git a/Detail.c b/Detail.c index 5819ced9..3d1957b8 100644 --- a/Detail.c +++ b/Detail.c @@ -275,7 +275,7 @@ int Detail(char *dev, struct context *c) array.major_version, array.minor_version); } - + //test if (info && memcmp(info->uuid, uuid_zero, sizeof(int[4])) != 0) mp = map_by_uuid(&map, info->uuid); if (!mp) diff --git a/test b/test index 3a05bc9b..6f3b45ac 100755 --- a/test +++ b/test @@ -102,6 +102,9 @@ do_test() { if [ -f "$_script" ] then + if [ "${_basename:0:2}" == "$skip_prefix" ]; then + return + fi if [ -f "${_script}.broken" ]; then _broken=1 _broken_msg=$(head -n1 "${_script}.broken" | tr -d '\n') @@ -162,6 +165,7 @@ do_help() { --loop=N Run tests N times (0 to run forever) --skip-broken Skip tests that are known to be broken --skip-always-broken Skip tests that are known to always fail + --skip=prefix Skip group of tests starting with --dev=loop|lvm|ram|disk Use loop devices (default), LVM, RAM or disk --disks= Provide a bunch of physical devices for test --volgroup=name LVM volume group for LVM test @@ -265,6 +269,9 @@ parse_args() { --skip-always-broken ) skipbroken=always ;; + --skip=* ) + skip_prefix="${i##*=}" + ;; --disable-multipath ) unset MULTIPATH ;; diff --git a/tests/07layouts.broken b/tests/07layouts.broken new file mode 100644 index 00000000..f6d69773 --- /dev/null +++ b/tests/07layouts.broken @@ -0,0 +1 @@ +always fails \ No newline at end of file diff --git a/tests/14imsm-r5_3d-migrate-r4_3d.broken b/tests/14imsm-r5_3d-migrate-r4_3d.broken new file mode 100644 index 00000000..f6d69773 --- /dev/null +++ b/tests/14imsm-r5_3d-migrate-r4_3d.broken @@ -0,0 +1 @@ +always fails \ No newline at end of file diff --git a/util.c b/util.c index 4dfe757d..ee97ac83 100644 --- a/util.c +++ b/util.c @@ -1159,8 +1159,6 @@ int open_dev_excl(char *devnm) flags = O_RDONLY; continue; } - if (errno != EBUSY) - return fd; sleep_for(0, MSEC_TO_NSEC(delay), true); if (delay < 200) delay *= 2;