diff --git a/.github/workflows/test-action.yml b/.github/workflows/test-action.yml index db69c04..fe85ec8 100644 --- a/.github/workflows/test-action.yml +++ b/.github/workflows/test-action.yml @@ -5,12 +5,14 @@ on: push: paths: - 'zram-config' + - 'ztab' - '**.bash' - 'tests/**' - '.github/workflows/test-action.yml' pull_request: paths: - 'zram-config' + - 'ztab' - '**.bash' - 'tests/**' - '.github/workflows/test-action.yml' @@ -52,4 +54,5 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: + name: logs.tar.gz path: logs.tar.gz diff --git a/README.md b/README.md index 7110cf1..5c220b6 100644 --- a/README.md +++ b/README.md @@ -125,11 +125,11 @@ Once finished, start zram using `sudo systemctl start zram-config.service` or `s # swap alg mem_limit disk_size swap_priority page-cluster swappiness swap lzo-rle 250M 750M 75 0 150 -# dir alg mem_limit disk_size target_dir bind_dir -#dir lzo-rle 50M 150M /home/pi /opt/zram/pi.bind +# dir alg mem_limit disk_size target_dir bind_dir +#dir lzo-rle 50M 150M /home/pi /pi.bind -# log alg mem_limit disk_size target_dir bind_dir oldlog_dir -log lzo-rle 50M 150M /var/log /opt/zram/log.bind /opt/zram/oldlog +# log alg mem_limit disk_size target_dir bind_dir oldlog_dir +log lzo-rle 50M 150M /var/log /log.bind /opt/zram/oldlog ``` ### Is it working? diff --git a/tests/image.bash b/tests/image.bash index 00c3670..44c3874 100755 --- a/tests/image.bash +++ b/tests/image.bash @@ -9,6 +9,7 @@ imageFile() { mkdir -p tests/{fs,kernel,dtb} mount -o rw -t ext4 "/dev/mapper/${loopPrefix}p2" "tests/fs" mount -o rw -t vfat "/dev/mapper/${loopPrefix}p1" "tests/fs/boot" + sync elif [[ $1 == "umount" ]]; then sync umount tests/fs/boot @@ -29,8 +30,8 @@ if [[ $1 == "setup" ]]; then echo ", +" | sfdisk -N 2 "$3" imageFile "mount" "$3" sed -i -e "s|DATESED|$(date)|" tests/run.exp - rsync -avr --exclude="*.img" --exclude="*.sig" --exclude="tests/fs" --exclude="tests/dtb" --exclude="tests/kernel" ./ tests/fs/opt/zram - systemd-nspawn --directory="tests/fs" /opt/zram/tests/install-packages.bash + rsync -avr --exclude="*.img" --exclude="*.sig" --exclude="tests/fs" --exclude="tests/dtb" --exclude="tests/kernel" ./ tests/fs/opt/zram-config + systemd-nspawn --directory="tests/fs" /opt/zram-config/tests/install-packages.bash echo "set enable-bracketed-paste off" >> tests/fs/etc/inputrc # Prevents weird character output cp tests/fs/boot/kernel* tests/kernel # Compile a customized DTB @@ -42,7 +43,7 @@ if [[ $1 == "setup" ]]; then imageFile "umount" "$3" elif [[ $1 == "copy-logs" ]]; then imageFile "mount" "$2" - cp tests/fs/opt/zram/logs.tar.gz . + cp tests/fs/opt/zram-config/logs.tar.gz logs.tar.gz imageFile "umount" "$2" fi diff --git a/tests/run.exp b/tests/run.exp index 7f1622c..4b2a501 100755 --- a/tests/run.exp +++ b/tests/run.exp @@ -41,28 +41,32 @@ expect { # Run tests expect "pi@raspberrypi:~$ " -send "sudo /opt/zram/install.bash\r" +send "sudo /opt/zram-config/install.bash\r" expect "pi@raspberrypi:~$ " -send "/opt/zram/tests/test-zram-devices.bash\r" +send "/opt/zram-config/tests/test-zram-devices.bash\r" expect { -re "Test failed:.*$" { set retval 1 exp_continue } "pi@raspberrypi:~$ " { - send "sudo /opt/zram/uninstall.bash\r" + send "sudo touch /var/log/test.txt\r" } } expect "pi@raspberrypi:~$ " -send "/opt/zram/tests/test-zram-devices.bash removal\r" +send "sudo /opt/zram-config/uninstall.bash\r" +expect "pi@raspberrypi:~$ " +send "/opt/zram-config/tests/test-zram-devices.bash removal\r" expect { -re "Test failed:.*$" { set retval 1 exp_continue } "pi@raspberrypi:~$ " { - send "sudo shutdown -h now\r" + send "sync\r" } } +expect "pi@raspberrypi:~$ " +send "sudo shutdown -h 5s\r" exit $retval diff --git a/uninstall.bash b/uninstall.bash index 16eb9f5..1dcc903 100755 --- a/uninstall.bash +++ b/uninstall.bash @@ -13,7 +13,7 @@ if ! [[ -f /usr/local/sbin/zram-config || -f /usr/sbin/zram-config ]]; then fi zram-config "stop" -tar -czvf "${BASEDIR}/logs.tar.gz" -C /usr/local/share/zram-config/log . +tar -czf "${BASEDIR}/logs.tar.gz" -C /usr/local/share/zram-config/log . if [[ $OS == "alpine" ]]; then rc-service zram-config stop rc-update del zram-config boot diff --git a/ztab b/ztab index 72246ce..e31d859 100644 --- a/ztab +++ b/ztab @@ -46,8 +46,8 @@ # swap alg mem_limit disk_size swap_priority page-cluster swappiness swap lzo-rle 250M 750M 75 0 150 -# dir alg mem_limit disk_size target_dir bind_dir -#dir lzo-rle 50M 150M /home/pi /opt/zram/pi.bind +# dir alg mem_limit disk_size target_dir bind_dir +#dir lzo-rle 50M 150M /home/pi /pi.bind -# log alg mem_limit disk_size target_dir bind_dir oldlog_dir -log lzo-rle 50M 150M /var/log /opt/zram/log.bind /opt/zram/oldlog +# log alg mem_limit disk_size target_dir bind_dir oldlog_dir +log lzo-rle 50M 150M /var/log /log.bind /opt/zram/oldlog