Skip to content

Commit

Permalink
CI: use self-hosted runner to run tests
Browse files Browse the repository at this point in the history
Use prepared VM machine in GitHub actions to run mdadm tests on it.

Signed-off-by: Kinga Stefaniuk <[email protected]>
  • Loading branch information
ktanska committed Oct 8, 2024
1 parent a06b956 commit 20e45f4
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 11 deletions.
9 changes: 9 additions & 0 deletions .github/tools/run_mdadm_tests.sh
Original file line number Diff line number Diff line change
@@ -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
41 changes: 41 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions test
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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 <prefix>

Check failure on line 168 in test

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING:EMBEDDED_FILENAME: It's generally not useful to have the filename in the file
--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
Expand Down Expand Up @@ -265,6 +269,9 @@ parse_args() {
--skip-always-broken )
skipbroken=always
;;
--skip=* )
skip_prefix="${i##*=}"
;;
--disable-multipath )
unset MULTIPATH
;;
Expand Down
1 change: 1 addition & 0 deletions tests/07layouts.broken
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
always fails
3 changes: 3 additions & 0 deletions tests/07reshape5intr.broken
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
always fails

hangs
1 change: 1 addition & 0 deletions tests/14imsm-r5_3d-migrate-r4_3d.broken
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
always fails
11 changes: 0 additions & 11 deletions util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1111,17 +1111,6 @@ int dev_open(char *dev, int flags)
fd = open(devname, flags);
unlink(devname);
}
if (fd < 0) {
/* Try /tmp as /dev appear to be read-only */
snprintf(devname, sizeof(devname),
"/tmp/.tmp.md.%d:%d:%d",
(int)getpid(), major, minor);
if (mknod(devname, S_IFBLK|0600,
makedev(major, minor)) == 0) {
fd = open(devname, flags);
unlink(devname);
}
}
} else
fd = open(dev, flags);
return fd;
Expand Down

0 comments on commit 20e45f4

Please sign in to comment.