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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
#!/bin/bash
if [ "x$1" = "x" ] || [ "x$2" = "x" ]; then
echo "Usage: $0 <source-dir> <output-file>"
exit -1
fi
source_dir=$1
out_file=$2
(cat <<EOF
#include <config.h>
#include "tests.h"
EOF
) > $out_file
echo "" >> $out_file
echo "#ifdef USE_CAIRO" >> $out_file
echo "// Cairo Tests" >> $out_file
for source_file in $(ls ${source_dir}/cairo-tests/*.cpp); do
test=$(basename ${source_file%.cpp})
test=${test/-/_}
(cat <<EOF
int ca_setup_${test}(struct _caskbench_context *ctx);
void ca_teardown_${test}();
int ca_test_${test}(struct _caskbench_context *ctx);
EOF
) >> $out_file
done
echo "#endif // USE_CAIRO" >> $out_file
echo "" >> $out_file
echo "#ifdef USE_SKIA" >> $out_file
echo "// Skia Tests" >> $out_file
for source_file in $(ls ${source_dir}/skia-tests/*.cpp); do
test=$(basename ${source_file%.cpp})
test=${test/-/_}
(cat <<EOF
int sk_setup_${test}(struct _caskbench_context *ctx);
void sk_teardown_${test}();
int sk_test_${test}(struct _caskbench_context *ctx);
EOF
) >> $out_file
done
echo "#endif // USE_SKIA" >> $out_file
echo "" >> $out_file
echo "caskbench_perf_test_t perf_tests[] = {" >> $out_file
for source_file in $(ls ${source_dir}/cairo-tests/*.cpp); do
original_test=$(basename ${source_file%.cpp})
test=${original_test/-/_}
if [ ! -e ${source_dir}/skia-tests/${original_test}.cpp ]; then
continue
fi
(cat <<EOF
#ifdef USE_CAIRO
{"cairo-${test}", ca_setup_${test}, ca_teardown_${test}, ca_test_${test},
write_image_file_cairo, context_setup_cairo, context_destroy_cairo, context_update_cairo, context_clear_cairo },
#endif
#ifdef USE_SKIA
{"skia-${test}", sk_setup_${test}, sk_teardown_${test}, sk_test_${test},
write_image_file_skia, context_setup_skia, context_destroy_skia, context_update_skia, context_clear_skia },
#endif
EOF
) >> $out_file
done
(cat <<EOF
};
const int num_perf_tests = sizeof(perf_tests) / sizeof(perf_tests[0]);
EOF
) >> $out_file
|