blob: 14293c64404a3401f7018b0b53ecd40eeaa2a508 [file] [log] [blame]
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +02001#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>
10using namespace std;
11
Christophe Favergeon59aeeea2019-11-20 13:39:05 +010012#ifdef BENCHMARK
13#define MEMSIZE 300000
14#else
Christophe Favergeond3e4eb92019-10-22 12:12:22 +010015#define MEMSIZE 230000
Christophe Favergeon59aeeea2019-11-20 13:39:05 +010016#endif
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +020017
18// Dummy (will be generated by python scripts)
19// char* array describing the tests and the input patterns.
20// Reference patterns are ignored in this case.
21#include "TestDrive.h"
22#include "Patterns.h"
23
24
Christophe Favergeon74a31ba2019-09-09 09:14:18 +010025
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +020026int testmain()
27{
28 char *memoryBuf=NULL;
Christophe Favergeon74a31ba2019-09-09 09:14:18 +010029
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +020030 memoryBuf = (char*)malloc(MEMSIZE);
31 if (memoryBuf !=NULL)
32 {
33 try
34 {
35 // Choice of a memory manager.
36 // Here we choose the Array one (only implemented one)
37 Client::ArrayMemory memory(memoryBuf,MEMSIZE);
38
39 // There is also possibility of using "FPGA" io
40 //Client::Semihosting io("../TestDesc.txt","../Patterns","../Output","../Parameters");
41 Client::FPGA io(testDesc,patterns);
42
43
44 // Pattern Manager making the link between IO and Memory
45 Client::PatternMgr mgr(&io,&memory);
46
47
48 // A Runner to run the test.
49 // An IO runner is driven by some IO
50 // In future one may have a client/server runner driven
51 // by a server running on a host.
Christophe Favergeon909d0162020-04-28 10:39:58 +020052 //Client::IORunner runner(&io,&mgr,Testing::kTestAndDump);
53 Client::IORunner runner(&io,&mgr,Testing::kTestOnly);
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +020054
55
56 // Root object containing all the tests
57 Root d(1);
58
59 // Runner applied to the tree of tests
60 d.accept(&runner);
61
62 }
63 catch(...)
64 {
65 printf("Exception\n");
66 }
67
68
69 free(memoryBuf);
70 }
71 else
72 {
73 printf("NOT ENOUGH MEMORY\n");
74 }
75
76 /* code */
77 return 0;
78}