aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJan Sucan <jan@jansucan.com>2024-12-28 12:17:37 +0100
committerJán Sučan <jan@jansucan.com>2024-12-28 12:47:08 +0100
commit217a6b905d46ee355373b2de60f0f36be828202c (patch)
tree62d5c4c3ab03068672735b73ed947a85bdeb5768 /tests
parent60a76d6ecbd76938cb73120f8c634223a02d503f (diff)
Rename reference file to base file for backup
Diffstat (limited to 'tests')
-rw-r--r--tests/004-unknown_option.sh2
-rw-r--r--tests/006-incorrect_buffer_size.sh6
-rw-r--r--tests/007-incorrect_sector_size.sh6
-rw-r--r--tests/100-cannot_open_files.sh18
-rw-r--r--tests/200-input_and_reference_size_differs.sh8
-rw-r--r--tests/201-input_or_reference_size_is_not_multiple_of_sector_size.sh10
-rw-r--r--tests/400-successful_backup_restore.sh18
7 files changed, 34 insertions, 34 deletions
diff --git a/tests/004-unknown_option.sh b/tests/004-unknown_option.sh
index 3373b0c..583f1ca 100644
--- a/tests/004-unknown_option.sh
+++ b/tests/004-unknown_option.sh
@@ -4,7 +4,7 @@ source ./assert.sh
PROGRAM_EXEC="$1"
-assert "Usage" "unknown option '-x'" 1 $PROGRAM_EXEC backup -x in ref out
+assert "Usage" "unknown option '-x'" 1 $PROGRAM_EXEC backup -x in base out
assert "Usage" "unknown option '-x'" 1 $PROGRAM_EXEC restore -x ref out
exit 0
diff --git a/tests/006-incorrect_buffer_size.sh b/tests/006-incorrect_buffer_size.sh
index 8640305..a579b26 100644
--- a/tests/006-incorrect_buffer_size.sh
+++ b/tests/006-incorrect_buffer_size.sh
@@ -4,9 +4,9 @@ source ./assert.sh
PROGRAM_EXEC="$1"
-assert "Usage" "incorrect sector size" 1 $PROGRAM_EXEC backup -s abc123 in ref out
-assert "Usage" "sector size cannot be 0" 1 $PROGRAM_EXEC backup -s 0 in ref out
-assert "Usage" "sector size cannot larger than buffer size" 1 $PROGRAM_EXEC backup -s 2 -b 1 in ref out
+assert "Usage" "incorrect sector size" 1 $PROGRAM_EXEC backup -s abc123 in base out
+assert "Usage" "sector size cannot be 0" 1 $PROGRAM_EXEC backup -s 0 in base out
+assert "Usage" "sector size cannot larger than buffer size" 1 $PROGRAM_EXEC backup -s 2 -b 1 in base out
assert "Usage" "incorrect sector size" 1 $PROGRAM_EXEC restore -s abc123 in out
assert "Usage" "sector size cannot be 0" 1 $PROGRAM_EXEC restore -s 0 in out
diff --git a/tests/007-incorrect_sector_size.sh b/tests/007-incorrect_sector_size.sh
index 6194d12..89f7051 100644
--- a/tests/007-incorrect_sector_size.sh
+++ b/tests/007-incorrect_sector_size.sh
@@ -4,9 +4,9 @@ source ./assert.sh
PROGRAM_EXEC="$1"
-assert "Usage" "incorrect buffer size" 1 $PROGRAM_EXEC backup -b abc123 in ref out
-assert "Usage" "buffer size cannot be 0" 1 $PROGRAM_EXEC backup -b 0 in ref out
-assert "Usage" "buffer size is not multiple of sector size" 1 $PROGRAM_EXEC backup -b 3 -s 2 in ref out
+assert "Usage" "incorrect buffer size" 1 $PROGRAM_EXEC backup -b abc123 in base out
+assert "Usage" "buffer size cannot be 0" 1 $PROGRAM_EXEC backup -b 0 in base out
+assert "Usage" "buffer size is not multiple of sector size" 1 $PROGRAM_EXEC backup -b 3 -s 2 in base out
assert "Usage" "incorrect buffer size" 1 $PROGRAM_EXEC restore -b abc123 in out
assert "Usage" "buffer size cannot be 0" 1 $PROGRAM_EXEC restore -b 0 in out
diff --git a/tests/100-cannot_open_files.sh b/tests/100-cannot_open_files.sh
index 4e7c45f..64d2a87 100644
--- a/tests/100-cannot_open_files.sh
+++ b/tests/100-cannot_open_files.sh
@@ -4,22 +4,22 @@ source ./assert.sh
PROGRAM_EXEC="$1"
-rm -f input ref out
-touch ref out
-assert "" "cannot get size of input file" 1 $PROGRAM_EXEC backup input ref out
+rm -f input base out
+touch base out
+assert "" "cannot get size of input file" 1 $PROGRAM_EXEC backup input base out
-rm -f input ref out
+rm -f input base out
touch input out
-assert "" "cannot get size of reference file" 1 $PROGRAM_EXEC backup input ref out
+assert "" "cannot get size of base file" 1 $PROGRAM_EXEC backup input base out
-rm -f input ref out
+rm -f input base out
rmdir outdir 2>/dev/null
-touch input ref
+touch input base
mkdir outdir
chmod -w outdir
-assert "" "cannot open output file" 1 $PROGRAM_EXEC backup input ref outdir/out
+assert "" "cannot open output file" 1 $PROGRAM_EXEC backup input base outdir/out
-rm -f input ref out
+rm -f input base out
rmdir outdir
exit 0
diff --git a/tests/200-input_and_reference_size_differs.sh b/tests/200-input_and_reference_size_differs.sh
index a17ecab..ca0f368 100644
--- a/tests/200-input_and_reference_size_differs.sh
+++ b/tests/200-input_and_reference_size_differs.sh
@@ -4,12 +4,12 @@ source ./assert.sh
PROGRAM_EXEC="$1"
-rm -f input ref
+rm -f input base
dd if=/dev/zero of=input bs=500 count=1 1>/dev/null 2>&1
-dd if=/dev/zero of=ref bs=501 count=1 1>/dev/null 2>&1
+dd if=/dev/zero of=base bs=501 count=1 1>/dev/null 2>&1
-assert "" "input file and reference file differ in size" 1 $PROGRAM_EXEC backup input ref out
+assert "" "input file and base file differ in size" 1 $PROGRAM_EXEC backup input base out
-rm -f input ref out
+rm -f input base out
exit 0
diff --git a/tests/201-input_or_reference_size_is_not_multiple_of_sector_size.sh b/tests/201-input_or_reference_size_is_not_multiple_of_sector_size.sh
index 2dd7d44..abfb3c5 100644
--- a/tests/201-input_or_reference_size_is_not_multiple_of_sector_size.sh
+++ b/tests/201-input_or_reference_size_is_not_multiple_of_sector_size.sh
@@ -4,13 +4,13 @@ source ./assert.sh
PROGRAM_EXEC="$1"
-rm -f input ref
+rm -f input base
dd if=/dev/zero of=input bs=513 count=1 1>/dev/null 2>&1
-dd if=/dev/zero of=ref bs=513 count=1 1>/dev/null 2>&1
+dd if=/dev/zero of=base bs=513 count=1 1>/dev/null 2>&1
-assert "" "size of input file and reference file is not multiple of [0-9]" \
- 1 $PROGRAM_EXEC backup -s 512 input ref out
+assert "" "size of input file and base file is not multiple of [0-9]" \
+ 1 $PROGRAM_EXEC backup -s 512 input base out
-rm -f input ref out
+rm -f input base out
exit 0
diff --git a/tests/400-successful_backup_restore.sh b/tests/400-successful_backup_restore.sh
index bf07a00..8274964 100644
--- a/tests/400-successful_backup_restore.sh
+++ b/tests/400-successful_backup_restore.sh
@@ -9,14 +9,14 @@ function files_are_the_same()
[ -z "$(diff "$1" "$2")" ]
}
-rm -f input backedup_input ref out
+rm -f input backedup_input base out
-# Create a four-sector reference file (the original file)
-dd if=/dev/zero of=ref bs=512 count=4 1>/dev/null 2>&1
+# Create a four-sector base file (the original file)
+dd if=/dev/zero of=base bs=512 count=4 1>/dev/null 2>&1
# Change the orignal file to make it an input file for differential backup
# There will be four different sectors in the input file
-cp ref input
+cp base input
# The first sector will have the 0th byte chaged
printf '\xFF' | dd of=input bs=1 count=1 seek=0 conv=notrunc 1>/dev/null 2>&1
@@ -29,7 +29,7 @@ printf '\xFF' | dd of=input bs=1 count=1 seek=$(( (512 * 3) - 1 )) conv=notrunc
# The fourth sector will have the middle byte changed
printf '\xFF' | dd of=input bs=1 count=1 seek=$(( (512 * 4) - (512 / 2) )) conv=notrunc 1>/dev/null 2>&1
-assert "" "" 0 $PROGRAM_EXEC backup -s 512 input ref out
+assert "" "" 0 $PROGRAM_EXEC backup -s 512 input base out
if ! files_are_the_same out 400-expected_backup_output.bin; then
echo "assert: Backup output file differs from the expected one"
@@ -38,9 +38,9 @@ fi
# Modify the file to backup (the input file used in the backup phase)
cp input backedup_input
-cp ref input
-if ! files_are_the_same ref input; then
- echo "assert: The input file must be the same as the reference one before restoring it"
+cp base input
+if ! files_are_the_same base input; then
+ echo "assert: The input file must be the same as the base one before restoring it"
exit 1
fi
@@ -51,6 +51,6 @@ if ! files_are_the_same input backedup_input; then
exit 1
fi
-rm -f input backedup_input ref out
+rm -f input backedup_input base out
exit 0