From 9de46c3479001102ce982c833e19b2733806b248 Mon Sep 17 00:00:00 2001 From: Kinga Stefaniuk Date: Tue, 3 Sep 2024 09:33:42 +0200 Subject: [PATCH] CI: use self-hosted runner to run tests Use prepared VM machine in GitHub actions to run mdadm tests on it. Signed-off-by: Kinga Stefaniuk --- .github/tools/run_basic_tests.sh | 9 ++ .github/tools/run_basic_tests_2.sh | 8 ++ .github/tools/run_ddf_tests.sh | 5 + .github/tools/run_imsm_test.sh | 5 + .github/tools/run_raidlevel_tests.sh | 8 ++ .github/workflows/review.yml | 33 +++++++ tests/07layouts.broken | 91 +++++++++++++++++++ tests/14imsm-r5_3d-migrate-r4_3d.broken | 21 +++++ ...15imsm-r0_3d_64k-migrate-r0_3d_256k.broken | 21 +++++ .../15imsm-r5_3d_4k-migrate-r5_3d_256k.broken | 21 +++++ ...15imsm-r5_3d_64k-migrate-r5_3d_256k.broken | 21 +++++ .../15imsm-r5_6d_4k-migrate-r5_6d_256k.broken | 21 +++++ ...-r5_r0_3d_64k-migrate-r5_r0_3d_256k.broken | 34 +++++++ 13 files changed, 298 insertions(+) create mode 100755 .github/tools/run_basic_tests.sh create mode 100755 .github/tools/run_basic_tests_2.sh create mode 100755 .github/tools/run_ddf_tests.sh create mode 100755 .github/tools/run_imsm_test.sh create mode 100755 .github/tools/run_raidlevel_tests.sh create mode 100644 tests/07layouts.broken create mode 100644 tests/14imsm-r5_3d-migrate-r4_3d.broken create mode 100644 tests/15imsm-r0_3d_64k-migrate-r0_3d_256k.broken create mode 100644 tests/15imsm-r5_3d_4k-migrate-r5_3d_256k.broken create mode 100644 tests/15imsm-r5_3d_64k-migrate-r5_3d_256k.broken create mode 100644 tests/15imsm-r5_6d_4k-migrate-r5_6d_256k.broken create mode 100644 tests/15imsm-r5_r0_3d_64k-migrate-r5_r0_3d_256k.broken diff --git a/.github/tools/run_basic_tests.sh b/.github/tools/run_basic_tests.sh new file mode 100755 index 00000000..47f4ae42 --- /dev/null +++ b/.github/tools/run_basic_tests.sh @@ -0,0 +1,9 @@ +#!/usr/bin/bash + +sudo make -j$(nproc) && sudo make install && dracut -f && sudo ./test cleanup && sudo ./test setup +sudo ./test 00 --skip-broken --skip-always-broken --no-error --disable-integrity --disable-multipath --disable-linear --keep-going --dev=loop +sudo ./test 01 --skip-broken --skip-always-broken --no-error --disable-integrity --disable-multipath --disable-linear --keep-going --dev=loop +sudo ./test 02 --skip-broken --skip-always-broken --no-error --disable-integrity --disable-multipath --disable-linear --keep-going --dev=loop +sudo ./test 03 --skip-broken --skip-always-broken --no-error --disable-integrity --disable-multipath --disable-linear --keep-going --dev=loop +sudo ./test 04 --skip-broken --skip-always-broken --no-error --disable-integrity --disable-multipath --disable-linear --keep-going --dev=loop +sudo ./test cleanup \ No newline at end of file diff --git a/.github/tools/run_basic_tests_2.sh b/.github/tools/run_basic_tests_2.sh new file mode 100755 index 00000000..5b666501 --- /dev/null +++ b/.github/tools/run_basic_tests_2.sh @@ -0,0 +1,8 @@ +#!/usr/bin/bash + +sudo make -j$(nproc) && sudo make install && dracut -f && sudo ./test cleanup && sudo ./test setup +sudo ./test 05 --skip-broken --skip-always-broken --no-error --disable-integrity --disable-multipath --disable-linear --keep-going --dev=loop +sudo ./test 06 --skip-broken --skip-always-broken --no-error --disable-integrity --disable-multipath --disable-linear --keep-going --dev=loop +sudo ./test 07 --skip-broken --skip-always-broken --no-error --disable-integrity --disable-multipath --disable-linear --keep-going --dev=loop +sudo ./test 08 --skip-broken --skip-always-broken --no-error --disable-integrity --disable-multipath --disable-linear --keep-going --dev=loop +sudo ./test cleanup \ No newline at end of file diff --git a/.github/tools/run_ddf_tests.sh b/.github/tools/run_ddf_tests.sh new file mode 100755 index 00000000..3ccab390 --- /dev/null +++ b/.github/tools/run_ddf_tests.sh @@ -0,0 +1,5 @@ +#!/usr/bin/bash + +sudo make -j$(nproc) && sudo make install && dracut -f && sudo ./test cleanup && sudo ./test setup +sudo ./test --raidtype=ddf --skip-broken --skip-always-broken --no-error --disable-integrity --disable-multipath --disable-linear --keep-going --dev=loop +sudo ./test cleanup \ No newline at end of file diff --git a/.github/tools/run_imsm_test.sh b/.github/tools/run_imsm_test.sh new file mode 100755 index 00000000..f8a753d7 --- /dev/null +++ b/.github/tools/run_imsm_test.sh @@ -0,0 +1,5 @@ +#!/usr/bin/bash + +sudo make -j$(nproc) && sudo make install && dracut -f && sudo ./test cleanup && sudo ./test setup +sudo ./test --raidtype=imsm --skip-broken --skip-always-broken --no-error --disable-integrity --disable-multipath --disable-linear --keep-going --dev=loop +sudo ./test cleanup \ No newline at end of file diff --git a/.github/tools/run_raidlevel_tests.sh b/.github/tools/run_raidlevel_tests.sh new file mode 100755 index 00000000..bdbb2e7d --- /dev/null +++ b/.github/tools/run_raidlevel_tests.sh @@ -0,0 +1,8 @@ +#!/usr/bin/bash + +sudo make -j$(nproc) && sudo make install && dracut -f && sudo ./test cleanup && sudo ./test setup +sudo ./test --raidtype=raid0 --skip-broken --skip-always-broken --no-error --disable-integrity --disable-multipath --disable-linear --keep-going --dev=loop +sudo ./test --raidtype=raid1 --skip-broken --skip-always-broken --no-error --disable-integrity --disable-multipath --disable-linear --keep-going --dev=loop +sudo ./test --raidtype=raid456 --skip-broken --skip-always-broken --no-error --disable-integrity --disable-multipath --disable-linear --keep-going --dev=loop +sudo ./test --raidtype=raid10 --skip-broken --skip-always-broken --no-error --disable-integrity --disable-multipath --disable-linear --keep-going --dev=loop +sudo ./test cleanup \ No newline at end of file diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml index e5fbf4ee..2ee271ab 100644 --- a/.github/workflows/review.yml +++ b/.github/workflows/review.yml @@ -43,3 +43,36 @@ jobs: run: mv .github/tools/.checkpatch.conf . - name: Run checkpatch review uses: webispy/checkpatch-action@v9 + upstream_tests: + runs-on: self-hosted + timeout-minutes: 120 + name: upstream tests + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + - name: 'run_basic_tests.sh' + run: | + vagrant snapshot restore clean_vm_v1 + echo "FYI vagrant restore command finished with exit code: $?" + sleep 2 + vagrant status + vagrant up + sleep 2 + vagrant ssh -c "ls && cd host/mdadm && .github/tools/run_raidlevel_tests.sh" + - name: 'run_basic_tests.sh 2' + run: | + vagrant ssh -c "ls && cd host/mdadm && .github/tools/run_basic_tests_2.sh" + - name: 'run_basic_tests.sh 2' + run: | + vagrant ssh -c "ls && cd host/mdadm && .github/tools/run_ddf_tests.sh" + - name: 'run_basic_tests.sh 2' + run: | + vagrant ssh -c "ls && cd host/mdadm && .github/tools/run_imsm_test.sh" + - name: 'run_basic_tests.sh 2' + run: | + vagrant ssh -c "ls && cd host/mdadm && .github/tools/run_basic_tests.sh" +# - uses: actions/download-artifact@v4 +# with: +# name: /var/tmp/*.log \ No newline at end of file diff --git a/tests/07layouts.broken b/tests/07layouts.broken new file mode 100644 index 00000000..acd1a800 --- /dev/null +++ b/tests/07layouts.broken @@ -0,0 +1,91 @@ + +# check that kernel an restripe interpret all the different layouts +# the same +# This involves changing the layout to each different possibility +# while MDADM_GROW_VERIFY is set. + +testK=$[64*3*6] +dd if=/dev/urandom of=/tmp/RandFile bs=1024 count=$testK +export MDADM_GROW_VERITY=1 + + +dotest() { + sleep 0.5 + check wait + testdev $md0 $1 $mdsize1 512 nd + blockdev --flushbufs $md0 + cmp -s -n $[textK*1024] $md0 /tmp/RandFile || { echo cmp failed; exit 2; } + # write something new - shift chars 4 space + tr ' -~' '$-~ -#' < /tmp/RandFile > /tmp/RandFile2 + mv /tmp/RandFile2 /tmp/RandFile + dd if=/tmp/RandFile of=$md0 +} + +checkgeo() { + # check the geometry of an array + # level raid_disks chunk_size layout + dev=$1 + shift + sleep 0.5 + check wait + for attr in level raid_disks chunk_size layout + do + if [ $# -gt 0 ] ; then + val=$1 + shift + if [ " `sed 's/ .*//' /sys/block/$dev/md/$attr`" != " $val" ] + then echo "$attr doesn't match for $dev" + exit 1 + fi + fi + done +} + + +bu=/tmp/md-test-backup +rm -f $bu + +# first a degraded 5 device raid5 +mdadm -CR $md0 -l5 -n5 $dev0 $dev1 missing $dev2 $dev3 +dd if=/tmp/RandFile of=$md0 +dotest 4 + +l5[0]=la +l5[1]=ra +l5[2]=ls +l5[3]=rs +l5[4]=parity-first +l5[5]=parity-last +for layout in 0 1 2 3 4 5 0 +do + mdadm -G $md0 --layout=${l5[$layout]} --backup-file $bu + checkgeo md0 raid5 5 $[512*1024] $layout + dotest 4 +done + +mdadm -S $md0 +# now a doubly degraded raid6 +mdadm -CR $md0 -l6 -n5 $dev0 missing $dev2 missing $dev4 +dd if=/tmp/RandFile of=$md0 +dotest 3 + +l6[0]=la +l6[1]=ra +l6[2]=ls +l6[3]=rs +l6[4]=parity-first +l6[5]=parity-last +l6[8]=ddf-zero-restart +l6[9]=ddf-N-restart +l6[10]=ddf-N-continue +l6[16]=left-asymmetric-6 +l6[17]=right-asymmetric-6 +l6[18]=left-symmetric-6 +l6[19]=right-symmetric-6 +l6[20]=parity-first-6 +for layout in 0 1 2 3 4 5 8 9 10 16 17 18 19 20 0 +do + mdadm -G $md0 --layout=${l6[$layout]} --backup-file $bu + checkgeo md0 raid6 5 $[512*1024] $layout + dotest 3 +done 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..e3b971cc --- /dev/null +++ b/tests/14imsm-r5_3d-migrate-r4_3d.broken @@ -0,0 +1,21 @@ +. tests/env-imsm-template + +# RAID 5 volume (3 disks) migrate to RAID 4 volume (3 disks) +# NEGATIVE test + +num_disks=3 +device_list="$dev0 $dev1 $dev2" + +# Before: RAID 5 volume, 3 disks, 64k chunk size +vol0_level=5 +vol0_comp_size=$((5 * 1024)) +vol0_chunk=64 +vol0_num_comps=$((num_disks - 1)) +vol0_offset=0 + +# After: RAID 4, 3 disks, 64k chunk size +vol0_new_level=4 +vol0_new_num_comps=$((num_disks - 1)) +vol0_new_chunk=64 + +. tests/imsm-grow-template 1 diff --git a/tests/15imsm-r0_3d_64k-migrate-r0_3d_256k.broken b/tests/15imsm-r0_3d_64k-migrate-r0_3d_256k.broken new file mode 100644 index 00000000..4fe3807e --- /dev/null +++ b/tests/15imsm-r0_3d_64k-migrate-r0_3d_256k.broken @@ -0,0 +1,21 @@ +. tests/env-imsm-template + +# RAID 0 volume, Migration from 64k to 256k chunk size. +# POSITIVE test + +num_disks=2 +device_list="$dev0 $dev1" + +# RAID 0, 2 disks, 64k chunk size +vol0_level=0 +vol0_comp_size=$((5 * 1024)) +vol0_chunk=64 +vol0_num_comps=$num_disks +vol0_offset=0 + +# RAID 0, 2 disks, 256k chunk size +vol0_new_level=0 +vol0_new_num_comps=$vol0_num_comps +vol0_new_chunk=256 + +. tests/imsm-grow-template 0 1 diff --git a/tests/15imsm-r5_3d_4k-migrate-r5_3d_256k.broken b/tests/15imsm-r5_3d_4k-migrate-r5_3d_256k.broken new file mode 100644 index 00000000..025e9efb --- /dev/null +++ b/tests/15imsm-r5_3d_4k-migrate-r5_3d_256k.broken @@ -0,0 +1,21 @@ +. tests/env-imsm-template + +# RAID 5 volume, Migration from 4k to 256 chunk size. +# POSITIVE test + +num_disks=3 +device_list="$dev0 $dev1 $dev2" + +# RAID 5, 3 disks, 4k chunk size +vol0_level=5 +vol0_comp_size=$((5 * 1024)) +vol0_chunk=4 +vol0_num_comps=$((num_disks - 1)) +vol0_offset=0 + +# RAID 5, 3 disks, 256k chunk size +vol0_new_level=5 +vol0_new_num_comps=$vol0_num_comps +vol0_new_chunk=256 + +. tests/imsm-grow-template 0 1 diff --git a/tests/15imsm-r5_3d_64k-migrate-r5_3d_256k.broken b/tests/15imsm-r5_3d_64k-migrate-r5_3d_256k.broken new file mode 100644 index 00000000..37547b74 --- /dev/null +++ b/tests/15imsm-r5_3d_64k-migrate-r5_3d_256k.broken @@ -0,0 +1,21 @@ +. tests/env-imsm-template + +# RAID 5 volume, Migration from 64k to 256k chunk size. +# POSITIVE test + +num_disks=3 +device_list="$dev0 $dev1 $dev2" + +# RAID 5, 3 disks, 64k chunk size +vol0_level=5 +vol0_comp_size=$((5 * 1024)) +vol0_chunk=64 +vol0_num_comps=$((num_disks - 1)) +vol0_offset=0 + +# RAID 5, 3 disks, 256k chunk size +vol0_new_level=5 +vol0_new_num_comps=$vol0_num_comps +vol0_new_chunk=256 + +. tests/imsm-grow-template 0 1 diff --git a/tests/15imsm-r5_6d_4k-migrate-r5_6d_256k.broken b/tests/15imsm-r5_6d_4k-migrate-r5_6d_256k.broken new file mode 100644 index 00000000..d2f6c707 --- /dev/null +++ b/tests/15imsm-r5_6d_4k-migrate-r5_6d_256k.broken @@ -0,0 +1,21 @@ +. tests/env-imsm-template + +# RAID 5 volume, Migration from 4k to 256k chunk size. +# POSITIVE test + +num_disks=6 +device_list="$dev0 $dev1 $dev2 $dev3 $dev4 $dev5" + +# RAID 5, 6 disks, 4k chunk size +vol0_level=5 +vol0_comp_size=$((5 * 1024)) +vol0_chunk=4 +vol0_num_comps=$((num_disks - 1)) +vol0_offset=0 + +# RAID 5, 6 disks, 256k chunk size +vol0_new_level=5 +vol0_new_num_comps=$vol0_num_comps +vol0_new_chunk=256 + +. tests/imsm-grow-template 0 1 diff --git a/tests/15imsm-r5_r0_3d_64k-migrate-r5_r0_3d_256k.broken b/tests/15imsm-r5_r0_3d_64k-migrate-r5_r0_3d_256k.broken new file mode 100644 index 00000000..f9369d5d --- /dev/null +++ b/tests/15imsm-r5_r0_3d_64k-migrate-r5_r0_3d_256k.broken @@ -0,0 +1,34 @@ +. tests/env-imsm-template + +# Member 0: RAID 5 volume, Member 1: RAID 0 volume +# Migration from 64k to 256k chunk size (both members) +# POSITIVE test + +num_disks=3 +device_list="$dev0 $dev1 $dev2" + +# RAID 5, 3 disks, 64k chunk size +vol0_level=5 +vol0_comp_size=$((5 * 1024)) +vol0_chunk=64 +vol0_num_comps=$((num_disks - 1)) +vol0_offset=0 + +# After migration parameters +vol0_new_level=5 +vol0_new_num_comps=$vol0_num_comps +vol0_new_chunk=256 + +# RAID 0, 3 disks, 64k chunk size +vol1_level=0 +vol1_comp_size=$((5 * 1024)) +vol1_chunk=64 +vol1_num_comps=$num_disks +vol1_offset=$((vol0_comp_size + 4096)) + +# After migration paramters +vol1_new_level=0 +vol1_new_num_comps=$vol1_num_comps +vol1_new_chunk=256 + +. tests/imsm-grow-template 0 1