Christophe Favergeon | 3b2a0ee | 2019-06-12 13:29:14 +0200 | [diff] [blame] | 1 | #include <cstdlib> |
| 2 | #include <cstdio> |
| 3 | #include <iostream> |
| 4 | #include "TestDesc.h" |
| 5 | #include "Semihosting.h" |
| 6 | #include "FPGA.h" |
| 7 | #include "IORunner.h" |
| 8 | #include "ArrayMemory.h" |
| 9 | #include <stdlib.h> |
| 10 | using namespace std; |
| 11 | |
Christophe Favergeon | d3e4eb9 | 2019-10-22 12:12:22 +0100 | [diff] [blame^] | 12 | #define MEMSIZE 230000 |
Christophe Favergeon | 3b2a0ee | 2019-06-12 13:29:14 +0200 | [diff] [blame] | 13 | |
| 14 | // Dummy (will be generated by python scripts) |
| 15 | // char* array describing the tests and the input patterns. |
| 16 | // Reference patterns are ignored in this case. |
| 17 | #include "TestDrive.h" |
| 18 | #include "Patterns.h" |
| 19 | |
| 20 | |
Christophe Favergeon | 74a31ba | 2019-09-09 09:14:18 +0100 | [diff] [blame] | 21 | |
Christophe Favergeon | 3b2a0ee | 2019-06-12 13:29:14 +0200 | [diff] [blame] | 22 | int testmain() |
| 23 | { |
| 24 | char *memoryBuf=NULL; |
Christophe Favergeon | 74a31ba | 2019-09-09 09:14:18 +0100 | [diff] [blame] | 25 | |
| 26 | |
| 27 | |
Christophe Favergeon | 3b2a0ee | 2019-06-12 13:29:14 +0200 | [diff] [blame] | 28 | |
| 29 | memoryBuf = (char*)malloc(MEMSIZE); |
| 30 | if (memoryBuf !=NULL) |
| 31 | { |
| 32 | try |
| 33 | { |
| 34 | // Choice of a memory manager. |
| 35 | // Here we choose the Array one (only implemented one) |
| 36 | Client::ArrayMemory memory(memoryBuf,MEMSIZE); |
| 37 | |
| 38 | // There is also possibility of using "FPGA" io |
| 39 | //Client::Semihosting io("../TestDesc.txt","../Patterns","../Output","../Parameters"); |
| 40 | Client::FPGA io(testDesc,patterns); |
| 41 | |
| 42 | |
| 43 | // Pattern Manager making the link between IO and Memory |
| 44 | Client::PatternMgr mgr(&io,&memory); |
| 45 | |
| 46 | |
| 47 | // A Runner to run the test. |
| 48 | // An IO runner is driven by some IO |
| 49 | // In future one may have a client/server runner driven |
| 50 | // by a server running on a host. |
| 51 | Client::IORunner runner(&io,&mgr,Testing::kTestAndDump); |
| 52 | |
| 53 | |
| 54 | // Root object containing all the tests |
| 55 | Root d(1); |
| 56 | |
| 57 | // Runner applied to the tree of tests |
| 58 | d.accept(&runner); |
| 59 | |
| 60 | } |
| 61 | catch(...) |
| 62 | { |
| 63 | printf("Exception\n"); |
| 64 | } |
| 65 | |
| 66 | |
| 67 | free(memoryBuf); |
| 68 | } |
| 69 | else |
| 70 | { |
| 71 | printf("NOT ENOUGH MEMORY\n"); |
| 72 | } |
| 73 | |
| 74 | /* code */ |
| 75 | return 0; |
| 76 | } |