source: trunk/softs/test_llsc/scripts/LLSCTestGenerator/Genere_Tests.cpp @ 661

Last change on this file since 661 was 536, checked in by meunier, 11 years ago

Added a tool which generates tests for the LL/SC table, in the soft/ directory.

File size: 1.3 KB
Line 
1/*
2 * Outil pour la génération de test de la table LL/SC
3 * @Author QM
4 */
5
6#include "Program.hpp"
7#include "config.h"
8
9#include <time.h>
10#include <cstdlib>
11#include <iostream>
12#include <cstdio>
13
14int main(int argc, char** argv){
15
16   if (argc != 9){
17      printf("usage: genere_test <nb_procs> <nb_max_incr> <nb_locks_and_vars> <locks_horizontal> <vars_horizontal> <native_filename> <main_task_filename> <task_no_tty_filename>\n");
18      exit(1);
19   }
20
21   srand(time(NULL));
22
23   FILE * native_file;
24   FILE * main_task_file;
25   FILE * task_no_tty_file;
26   
27   native_file = fopen(argv[6], "w");
28   main_task_file = fopen(argv[7], "w");
29   task_no_tty_file = fopen(argv[8], "w");
30
31   const int nb_procs = atoi(argv[1]);
32   const int nb_max_incr = atoi(argv[2]);
33   const int nb_locks = atoi(argv[3]);
34
35   const bool lock_horizontal = atoi(argv[4]);
36   const bool vars_horizontal = atoi(argv[5]);
37
38        const int line_size = LINE_SIZE;
39
40   Program prog(nb_procs, nb_locks, nb_max_incr, line_size, lock_horizontal, vars_horizontal);
41
42   string s = prog.write_output();
43   fprintf(native_file, "%s", s.c_str());
44   fclose(native_file);
45
46   s = prog.write_main_task();
47   fprintf(main_task_file, "%s", s.c_str());
48   fclose(main_task_file);
49 
50   s = prog.write_task_no_tty();
51   fprintf(task_no_tty_file, "%s", s.c_str());
52   fclose(task_no_tty_file); 
53
54   return 0;
55}
56
57
58
Note: See TracBrowser for help on using the repository browser.