From ba27a25f13a8ff3ba3b6d07f3ed77e8b150c3f64 Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Mon, 5 Apr 2010 00:33:08 +0200 Subject: Add more regression tests Signed-off-by: Michael Buesch --- tests/run-tests.sh | 7 ++++++- tests/top2049/001-atmega32dip40.test | 2 +- tests/top2049/001-atmega88dip28.test | 39 ++++++++++++++++++++++++++++++++++++ tests/top2049/001-atmega8dip28.test | 39 ++++++++++++++++++++++++++++++++++++ tests/top2049/001-attiny13dip8.test | 39 ++++++++++++++++++++++++++++++++++++ 5 files changed, 124 insertions(+), 2 deletions(-) create mode 100644 tests/top2049/001-atmega88dip28.test create mode 100644 tests/top2049/001-atmega8dip28.test create mode 100644 tests/top2049/001-attiny13dip8.test (limited to 'tests') 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 -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" +} -- cgit v1.2.3