testmain.cpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. #ifdef BENCHMARK
  12. #define MEMSIZE 300000
  13. #else
  14. #define MEMSIZE 230000
  15. #endif
  16. // Dummy (will be generated by python scripts)
  17. // char* array describing the tests and the input patterns.
  18. // Reference patterns are ignored in this case.
  19. #include "TestDrive.h"
  20. #include "Patterns.h"
  21. int testmain()
  22. {
  23. char *memoryBuf=NULL;
  24. memoryBuf = (char*)malloc(MEMSIZE);
  25. if (memoryBuf !=NULL)
  26. {
  27. try
  28. {
  29. // Choice of a memory manager.
  30. // Here we choose the Array one (only implemented one)
  31. Client::ArrayMemory memory(memoryBuf,MEMSIZE);
  32. // There is also possibility of using "FPGA" io
  33. //Client::Semihosting io("../TestDesc.txt","../Patterns","../Output","../Parameters");
  34. Client::FPGA io(testDesc,patterns);
  35. // Pattern Manager making the link between IO and Memory
  36. Client::PatternMgr mgr(&io,&memory);
  37. // A Runner to run the test.
  38. // An IO runner is driven by some IO
  39. // In future one may have a client/server runner driven
  40. // by a server running on a host.
  41. //Client::IORunner runner(&io,&mgr,Testing::kTestAndDump);
  42. Client::IORunner runner(&io,&mgr,Testing::kTestOnly);
  43. // Root object containing all the tests
  44. Root d(1);
  45. // Runner applied to the tree of tests
  46. d.accept(&runner);
  47. }
  48. catch(...)
  49. {
  50. printf("Exception\n");
  51. }
  52. free(memoryBuf);
  53. }
  54. else
  55. {
  56. printf("NOT ENOUGH MEMORY\n");
  57. }
  58. /* code */
  59. return 0;
  60. }