blob: 3186030e160e72fdd67e6e65ed9b829ce17159a8 [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
30
31
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +020032
33 memoryBuf = (char*)malloc(MEMSIZE);
34 if (memoryBuf !=NULL)
35 {
36 try
37 {
38 // Choice of a memory manager.
39 // Here we choose the Array one (only implemented one)
40 Client::ArrayMemory memory(memoryBuf,MEMSIZE);
41
42 // There is also possibility of using "FPGA" io
43 //Client::Semihosting io("../TestDesc.txt","../Patterns","../Output","../Parameters");
44 Client::FPGA io(testDesc,patterns);
45
46
47 // Pattern Manager making the link between IO and Memory
48 Client::PatternMgr mgr(&io,&memory);
49
50
51 // A Runner to run the test.
52 // An IO runner is driven by some IO
53 // In future one may have a client/server runner driven
54 // by a server running on a host.
55 Client::IORunner runner(&io,&mgr,Testing::kTestAndDump);
56
57
58 // Root object containing all the tests
59 Root d(1);
60
61 // Runner applied to the tree of tests
62 d.accept(&runner);
63
64 }
65 catch(...)
66 {
67 printf("Exception\n");
68 }
69
70
71 free(memoryBuf);
72 }
73 else
74 {
75 printf("NOT ENOUGH MEMORY\n");
76 }
77
78 /* code */
79 return 0;
80}