summaryrefslogtreecommitdiffstats
path: root/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/scripts/add_test_list.awk
blob: 1fbe2840121723c24a03d748c1d5442e2987a0fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
BEGIN {
  Test_Count = 0;
  count_cpp = split(sources_cpp, source_list_cpp, " ");
  printf("#count_cpp= %d\n", count_cpp);
  count_h = split(sources_h, source_list_h, " ");
  printf("#count_h= %d\n", count_h);
}
{
  theLine = $0;
  command = substr(theLine, 10);
  split(command, parts, " ");
  number = parts[1];
  lang = substr(parts[4], 14);
  l_lang = length(lang);
  lang_2 = substr(lang, 1, l_lang - 1);
  config = substr(parts[5], 16);
  input_file = substr(parts[7], 15);

  printf("echo \"Run uncrustify: The TESTNUMBER is %s\"\n", number);
  printf("rm -rf %s\n", number);
  printf("mkdir %s\n", number);
  printf("cd %s\n", number);
  printf("mkdir save\n");
  printf("../uncrustify -q -c \"../../tests/%s -f \"../../tests/%s -l %s -o /dev/null\n",
         config, input_file, lang_2);
  for (i = 1; i <= count_cpp; i++) {
    source_file = source_list_cpp[i];
    function_file = sprintf("../CMakeFiles/uncrustify.dir/src/%s.gcno", source_file);
    printf("if [ -s %s ] ;\n", function_file);
    printf("then\n");
    printf("  gcov %s 2> /dev/null 1> /dev/null\n", function_file, source_file);
    printf("fi\n");
    printf("if [ -s %s.* ] ;\n", source_file);
    printf("then\n");
    printf("   mv -f %s.* ./save/\n", source_file);
    printf("fi\n");
  }
  for (i = 1; i <= count_h; i++) {
    source_file = source_list_h[i];
    printf("if [ -s %s.* ] ;\n", source_file);
    printf("then\n");
    printf("   mv -f %s.* ./save/\n", source_file);
    printf("fi\n");
  }
  printf("  rm *.gcov\n");
  printf("  mv save/* .\n");
  printf("rmdir save\n");
  printf("cd ..\n\n");
  # to brake before the end
  #Test_Count = Test_Count + 1;
  #if ( Test_Count == 1000) {
  #if ( Test_Count == 109) {
  #if ( Test_Count == 2) {
  #  printf("exit\n");
  #}
}