blob: a7ff79c439da936b10e3b18f189ad6cfc28857c1 [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.
Christophe Favergeon909d0162020-04-28 10:39:58 +020055 //Client::IORunner runner(&io,&mgr,Testing::kTestAndDump);
56 Client::IORunner runner(&io,&mgr,Testing::kTestOnly);
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +020057
58
59 // Root object containing all the tests
60 Root d(1);
61
62 // Runner applied to the tree of tests
63 d.accept(&runner);
64
65 }
66 catch(...)
67 {
68 printf("Exception\n");
69 }
70
71
72 free(memoryBuf);
73 }
74 else
75 {
76 printf("NOT ENOUGH MEMORY\n");
77 }
78
79 /* code */
80 return 0;
81}