summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2010-04-05 00:33:08 +0200
committerMichael Buesch <mb@bu3sch.de>2010-04-05 00:33:08 +0200
commitba27a25f13a8ff3ba3b6d07f3ed77e8b150c3f64 (patch)
tree9bf7ba1e2dd846c531117fd781b308c6936e56e3 /tests
parentafc27f5aa5db1196ccf0a7fa85aa8a93a8564352 (diff)
downloadtoprammer-ba27a25f13a8ff3ba3b6d07f3ed77e8b150c3f64.tar.xz
toprammer-ba27a25f13a8ff3ba3b6d07f3ed77e8b150c3f64.zip
Add more regression tests
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/run-tests.sh7
-rw-r--r--tests/top2049/001-atmega32dip40.test2
-rw-r--r--tests/top2049/001-atmega88dip28.test39
-rw-r--r--tests/top2049/001-atmega8dip28.test39
-rw-r--r--tests/top2049/001-attiny13dip8.test39
5 files changed, 124 insertions, 2 deletions
diff --git a/tests/run-tests.sh b/tests/run-tests.sh
index 15af820..5c3bd9b 100755
--- a/tests/run-tests.sh
+++ b/tests/run-tests.sh
@@ -2,7 +2,9 @@
# Toprammer regression tests
# Copyright (c) 2010 Michael Buesch <mb@bu3sch.de>
-basedir="$PWD/$(dirname $0)"
+basedir="$(dirname "$0")"
+[ "${basedir:0:1}" = "/" ] || basedir="$PWD/$basedir"
+
tmpdir="/tmp/toprammer-test-$$"
@@ -131,6 +133,9 @@ mkdir -p "$tmpdir"
# Create various test files
tmpfile="$tmpdir/tmpfile"
+testfile_64="$tmpdir/testfile_64"
+create_random_file "$testfile_64" 64 1
+
testfile_128="$tmpdir/testfile_128"
create_random_file "$testfile_128" 128 1
diff --git a/tests/top2049/001-atmega32dip40.test b/tests/top2049/001-atmega32dip40.test
index cc5f324..0820421 100644
--- a/tests/top2049/001-atmega32dip40.test
+++ b/tests/top2049/001-atmega32dip40.test
@@ -34,6 +34,6 @@ function test_run
# Check lockbits
toprammer $args --read-lock "$tmpfile"
- compare_file_to_hex "$tmpfile" "FF" || die "fuses mismatch"
+ compare_file_to_hex "$tmpfile" "FF" || die "lockbits mismatch"
toprammer $args --write-lock "$tmpfile"
}
diff --git a/tests/top2049/001-atmega88dip28.test b/tests/top2049/001-atmega88dip28.test
new file mode 100644
index 0000000..4dd6d11
--- /dev/null
+++ b/tests/top2049/001-atmega88dip28.test
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+function test_init
+{
+ request_DUT "atmega88dip28" || return 1
+ return 0
+}
+
+function test_run
+{
+ local args="-c atmega88dip28 -I bin -O bin"
+
+ # Check signature
+ toprammer $args --read-sig "$tmpfile"
+ compare_file_to_hex "$tmpfile" "1E930A" || die "signature mismatch"
+
+ toprammer $args --erase
+
+ # Check progmem
+ toprammer $args --write-prog "$testfile_8k"
+ toprammer $args --read-prog "$tmpfile"
+ compare_files "$testfile_8k" "$tmpfile" || die "progmem mismatch"
+
+ # Check EEPROM
+ toprammer $args --write-eeprom "$testfile_512"
+ toprammer $args --read-eeprom "$tmpfile"
+ compare_files "$testfile_512" "$tmpfile" || die "EEPROM mismatch"
+
+ # Check fuses
+#TODO testfuses="E1D9"
+# echo "0x0000: $testfuses" | toprammer $args -I hex --write-fuse -
+# toprammer $args --read-fuse "$tmpfile"
+# compare_file_to_hex "$tmpfile" "$testfuses" || die "fuses mismatch"
+
+ # Check lockbits
+ toprammer $args --read-lock "$tmpfile"
+ compare_file_to_hex "$tmpfile" "FF" || die "lockbits mismatch"
+ toprammer $args --write-lock "$tmpfile"
+}
diff --git a/tests/top2049/001-atmega8dip28.test b/tests/top2049/001-atmega8dip28.test
new file mode 100644
index 0000000..d519adb
--- /dev/null
+++ b/tests/top2049/001-atmega8dip28.test
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+function test_init
+{
+ request_DUT "atmega8dip28" || return 1
+ return 0
+}
+
+function test_run
+{
+ local args="-c atmega8dip28 -I bin -O bin"
+
+ # Check signature
+ toprammer $args --read-sig "$tmpfile"
+ compare_file_to_hex "$tmpfile" "1E9307" || die "signature mismatch"
+
+ toprammer $args --erase
+
+ # Check progmem
+ toprammer $args --write-prog "$testfile_8k"
+ toprammer $args --read-prog "$tmpfile"
+ compare_files "$testfile_8k" "$tmpfile" || die "progmem mismatch"
+
+ # Check EEPROM
+ toprammer $args --write-eeprom "$testfile_512"
+ toprammer $args --read-eeprom "$tmpfile"
+ compare_files "$testfile_512" "$tmpfile" || die "EEPROM mismatch"
+
+ # Check fuses
+ testfuses="E1D9"
+ echo "0x0000: $testfuses" | toprammer $args -I hex --write-fuse -
+ toprammer $args --read-fuse "$tmpfile"
+ compare_file_to_hex "$tmpfile" "$testfuses" || die "fuses mismatch"
+
+ # Check lockbits
+ toprammer $args --read-lock "$tmpfile"
+ compare_file_to_hex "$tmpfile" "FF" || die "lockbits mismatch"
+ toprammer $args --write-lock "$tmpfile"
+}
diff --git a/tests/top2049/001-attiny13dip8.test b/tests/top2049/001-attiny13dip8.test
new file mode 100644
index 0000000..75f12f9
--- /dev/null
+++ b/tests/top2049/001-attiny13dip8.test
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+function test_init
+{
+ request_DUT "attiny13dip8" || return 1
+ return 0
+}
+
+function test_run
+{
+ local args="-c attiny13dip8 -I bin -O bin"
+
+ # Check signature
+ toprammer $args --read-sig "$tmpfile"
+ compare_file_to_hex "$tmpfile" "1E9007" || die "signature mismatch"
+
+ toprammer $args --erase
+
+ # Check progmem
+ toprammer $args --write-prog "$testfile_1k"
+ toprammer $args --read-prog "$tmpfile"
+ compare_files "$testfile_1k" "$tmpfile" || die "progmem mismatch"
+
+ # Check EEPROM
+ toprammer $args --write-eeprom "$testfile_64"
+ toprammer $args --read-eeprom "$tmpfile"
+ compare_files "$testfile_64" "$tmpfile" || die "EEPROM mismatch"
+
+ # Check fuses
+ testfuses="6AFF"
+ echo "0x0000: $testfuses" | toprammer $args -I hex --write-fuse -
+ toprammer $args --read-fuse "$tmpfile"
+ compare_file_to_hex "$tmpfile" "$testfuses" || die "fuses mismatch"
+
+ # Check lockbits
+ toprammer $args --read-lock "$tmpfile"
+ compare_file_to_hex "$tmpfile" "FF" || die "lockbits mismatch"
+ toprammer $args --write-lock "$tmpfile"
+}
bues.ch cgit interface