Skip to content

Commit

Permalink
Improve tests
Browse files Browse the repository at this point in the history
Signed-off-by: Ethan Dye <[email protected]>
  • Loading branch information
ecdye committed Dec 5, 2024
1 parent 75e7ec8 commit 24b162e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions tests/image.bash
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,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
Expand All @@ -42,7 +42,7 @@ if [[ $1 == "setup" ]]; then
imageFile "umount" "$3"
elif [[ $1 == "copy-logs" ]]; then
imageFile "mount" "$2"
cp tests/fs/opt/zram/logs.tar.gz logs.tar.gz
cp tests/fs/opt/zram-config/logs.tar.gz logs.tar.gz
imageFile "umount" "$2"
fi

Expand Down
10 changes: 5 additions & 5 deletions tests/run.exp
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,22 @@ 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 "touch /var/log/test.txt\r"
send "sudo touch /var/log/test.txt\r"
}
}
expect "pi@raspberrypi:~$ "
send "sudo /opt/zram/uninstall.bash\r"
send "sudo /opt/zram-config/uninstall.bash\r"
expect "pi@raspberrypi:~$ "
send "/opt/zram/tests/test-zram-devices.bash removal\r"
send "/opt/zram-config/tests/test-zram-devices.bash removal\r"
expect {
-re "Test failed:.*$" {
set retval 1
Expand Down
1 change: 0 additions & 1 deletion uninstall.bash
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ fi
rm -f /etc/logrotate.d/zram-config
rm -f /etc/ztab
rm -rf /usr/local/lib/zram-config
cat /usr/local/share/zram-config/log/zram-config.log
rm -rf /usr/local/share/zram-config
rm -f /var/log/zram-config

Expand Down

0 comments on commit 24b162e

Please sign in to comment.