stc8: add tests

Add a standard programming test for STC8A8 series and integrate it into
the fuzzer.

The fuzzing tests currently fail.
This commit is contained in:
Grigori Goronzy 2018-08-21 13:15:29 +02:00
parent c7c4937628
commit 11d2ea22e6
3 changed files with 30 additions and 0 deletions

20
tests/stc8a8k64s4a12.yml Normal file
View File

@ -0,0 +1,20 @@
name: STC8A8K64S4A12 programming test
protocol: stc8
code_data: [49, 50, 51, 52, 53, 54, 55, 56, 57]
responses:
- [0x50, 0x01, 0x6E, 0x0B, 0xD0, 0x78, 0x00, 0x01, 0xFF, 0xFF, 0x8B, 0xBF, 0xFF, 0x28, 0x43, 0xF7, 0xFE, 0x73, 0x55, 0x00, 0xF6, 0x28, 0x09, 0x85, 0xE3, 0x5F, 0x80, 0x07, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0xFE, 0x05, 0x3A, 0x17, 0x05, 0x25, 0x91, 0xFF]
- [0x00, 0x0C, 0x37, 0x49, 0x3B, 0x8D, 0x3F, 0xE0, 0x44, 0x57, 0x48, 0x9E, 0x4D, 0x06, 0x51, 0x35, 0x55, 0x94, 0x59, 0xCF, 0x5D, 0xDA, 0x62, 0x3C, 0x66, 0xDA]
- [0x00, 0x0C, 0x51, 0x59, 0x51, 0x8C, 0x51, 0xB3, 0x51, 0x71, 0x51, 0x9B, 0x51, 0xC2, 0x51, 0x77, 0x51, 0xAA, 0x51, 0xC8, 0x51, 0x62, 0x51, 0x89, 0x51, 0xB0]
- [0x01]
- [0x05]
- [0x03, 0xF6, 0x28, 0x02, 0xBC, 0x26, 0x98, 0xDF]
- [0x02, 0x54]
- [0x02, 0x54]
- [0x02, 0x54]
- [0x02, 0x54]
- [0x02, 0x54]
- [0x02, 0x54]
- [0x02, 0x54]
- [0x02, 0x54]
- [0x07, 0x54]
- [0x04, 0x54]

View File

@ -85,6 +85,7 @@ class TestProgramFuzzed(unittest.TestCase):
"./tests/stc89c52rc.yml", "./tests/stc89c52rc.yml",
"./tests/stc15l104w.yml", "./tests/stc15l104w.yml",
"./tests/stc15f104e.yml", "./tests/stc15f104e.yml",
"./tests/stc8a8k64s4a12.yml",
] ]
fuzzer = ByteArrayFuzzer() fuzzer = ByteArrayFuzzer()
fuzzer.cut_propability = 0.01 fuzzer.cut_propability = 0.01

View File

@ -99,6 +99,15 @@ class ProgramTests(unittest.TestCase):
"""Test a programming cycle with STC15 protocol, W4 series""" """Test a programming cycle with STC15 protocol, W4 series"""
self._program_yml("./tests/stc15w4k56s4.yml", serial_mock, read_mock) self._program_yml("./tests/stc15w4k56s4.yml", serial_mock, read_mock)
@patch("stcgal.protocols.StcBaseProtocol.read_packet")
@patch("stcgal.protocols.Stc89Protocol.write_packet")
@patch("stcgal.protocols.serial.Serial", autospec=True)
@patch("stcgal.protocols.time.sleep")
@patch("sys.stdout")
def test_program_stc8a8(self, out, sleep_mock, serial_mock, write_mock, read_mock):
"""Test a programming cycle with STC8 protocol, STC8A8 series"""
self._program_yml("./tests/stc8a8k64s4a12.yml", serial_mock, read_mock)
@unittest.skip("trace is broken") @unittest.skip("trace is broken")
@patch("stcgal.protocols.StcBaseProtocol.read_packet") @patch("stcgal.protocols.StcBaseProtocol.read_packet")
@patch("stcgal.protocols.Stc89Protocol.write_packet") @patch("stcgal.protocols.Stc89Protocol.write_packet")