Adding Visual namespace and Visual becomes Visual::Base
[platform/core/uifw/dali-toolkit.git] / automated-tests / scripts / tcheadgen.sh
1 #!/bin/bash
2
3 if [[ -z $1 ]]; then
4     echo "Usage note: tcheadgen.sh <header_filename.h>"
5     exit 1
6 fi
7
8 FILE="$PWD/$1"
9 TFILE="/tmp/retr.csv"
10 HEADER_NAME=$(echo $1 | tr '[:lower:]' '[:upper:]' | sed -e 's/-/_/g' -e 's/\./_/')
11 SCRIPT_DIR="$(cd "$(dirname $0)" && pwd)"
12
13 $SCRIPT_DIR/retriever.sh > $TFILE
14 if [ $? -ne 0 ]; then cat $TFILE; exit 1; fi
15 awk -F',' -v HEADER_NAME="$HEADER_NAME" '
16     BEGIN {
17         OFS = ", ";
18
19         startup_counter = 0;
20         startup_list[0] = "";
21
22         cleanup_counter = 0;
23         cleanup_list[0] = "";
24
25         testcase_counter = 0;
26         testcase_list[0] = "";
27
28         tc_array_counter = 0;
29         tc_array_list[0] = "";
30
31 print "#ifndef __" HEADER_NAME "__"
32 print "#define __" HEADER_NAME "__"
33 print ""
34 print "#include \"testcase.h\""
35 print ""
36     }
37     {
38         testcase_list[testcase_counter++] = $1;
39
40         if (startup_counter == 0 || startup_list[startup_counter-1] != $2)
41             startup_list[startup_counter++] = $2;
42
43         if (startup_counter == 0 || cleanup_list[cleanup_counter-1] != $3)
44             cleanup_list[cleanup_counter++] = $3;
45
46         tc_array_list[tc_array_counter++] = "\"" $1 "\", " $1 ", " $2 ", " $3;
47     }
48     END {
49         sc_count = (startup_counter > cleanup_counter) ? startup_counter : cleanup_counter;
50         for (i = 0; i < sc_count; i++) {
51             if (i < startup_counter && startup_list[i] != "NULL")
52 print "extern void " startup_list[i] "(void);"
53             if (i < cleanup_counter && cleanup_list[i] != "NULL")
54 print "extern void " cleanup_list[i] "(void);"
55         }
56
57 print ""
58         for (i = 0; i < testcase_counter; i++)
59 print "extern int " testcase_list[i] "(void);"
60
61 print ""
62 print "testcase tc_array[] = {"
63
64         for (i = 0; i < tc_array_counter; i++)
65 print "    {" tc_array_list[i] "},"
66
67 print "    {NULL, NULL}"
68 print "};"
69 print ""
70 print "#endif // __" HEADER_NAME "__"
71 }' $TFILE > $FILE