blob: aecdb43fbf074c936e28b11d09bf55b7c94bbae9 [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"
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +020022
23
Christophe Favergeon74a31ba2019-09-09 09:14:18 +010024
Christophe Favergeond99acab2020-05-11 13:40:39 +020025int testmain(const char *patterns)
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +020026{
27 char *memoryBuf=NULL;
Christophe Favergeon74a31ba2019-09-09 09:14:18 +010028
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +020029 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.
Christophe Favergeon909d0162020-04-28 10:39:58 +020051 //Client::IORunner runner(&io,&mgr,Testing::kTestAndDump);
52 Client::IORunner runner(&io,&mgr,Testing::kTestOnly);
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +020053
54
55 // Root object containing all the tests
56 Root d(1);
57
58 // Runner applied to the tree of tests
59 d.accept(&runner);
60
61 }
62 catch(...)
63 {
64 printf("Exception\n");
65 }
66
67
68 free(memoryBuf);
69 }
70 else
71 {
72 printf("NOT ENOUGH MEMORY\n");
73 }
74
75 /* code */
76 return 0;
77}