Merge "added FONT_SIZE_SCALE("fontSizeScale") DevelProperty into TextLabel, TextField...
[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> <test-sources>"
5     exit 1
6 fi
7
8 FILE="$PWD/$1"
9 shift
10 TC_FILES=$*
11 TFILE="/tmp/retr.csv$$"
12 HEADER_NAME=$(echo $1 | tr '[:lower:]' '[:upper:]' | sed -e 's/-/_/g' -e 's/\./_/')
13 SCRIPT_DIR="$(cd "$(dirname $0)" && pwd)"
14
15 $SCRIPT_DIR/retriever.sh $TC_FILES > $TFILE
16 if [ $? -ne 0 ]; then cat $TFILE; exit 1; fi
17 awk -F',' -v HEADER_NAME="$HEADER_NAME" '
18     BEGIN {
19         OFS = ", ";
20
21         startup_counter = 0;
22         startup_list[0] = "";
23
24         cleanup_counter = 0;
25         cleanup_list[0] = "";
26
27         testcase_counter = 0;
28         testcase_list[0] = "";
29
30         tc_array_counter = 0;
31         tc_array_list[0] = "";
32
33 print "#ifndef " HEADER_NAME
34 print "#define " HEADER_NAME
35 print ""
36 print "#include \"testcase.h\""
37 print ""
38     }
39     {
40         testcase_list[testcase_counter++] = $1;
41
42         if (startup_counter == 0 || startup_list[startup_counter-1] != $2)
43             startup_list[startup_counter++] = $2;
44
45         if (startup_counter == 0 || cleanup_list[cleanup_counter-1] != $3)
46             cleanup_list[cleanup_counter++] = $3;
47
48         tc_array_list[tc_array_counter++] = "\"" $1 "\", " $1 ", " $2 ", " $3;
49     }
50     END {
51         sc_count = (startup_counter > cleanup_counter) ? startup_counter : cleanup_counter;
52         for (i = 0; i < sc_count; i++) {
53             if (i < startup_counter && startup_list[i] != "NULL")
54 print "extern void " startup_list[i] "(void);"
55             if (i < cleanup_counter && cleanup_list[i] != "NULL")
56 print "extern void " cleanup_list[i] "(void);"
57         }
58
59 print ""
60         for (i = 0; i < testcase_counter; i++)
61 print "extern int " testcase_list[i] "(void);"
62
63 print ""
64 print "testcase tc_array[] = {"
65
66         for (i = 0; i < tc_array_counter; i++)
67 print "    {" tc_array_list[i] "},"
68
69 print "    {NULL, NULL}"
70 print "};"
71 print ""
72 print "#endif // " HEADER_NAME
73 }' $TFILE > $FILE
74 unlink $TFILE