#!/bin/bash # coverage_test.sh - Don Yang (uguu.org) # # Coverage targets are built and tested with this script instead of # Makefile because: # - They shouldn't be parallelized, so we don't want them to be # accidentally parallelized through "make -j". # - They don't work with MingW # # 06/16/11 set -e cflags="-Wall -Werror -fprofile-arcs -ftest-coverage" lflags="-fprofile-arcs -ftest-coverage" # Compile perl compile_template.pl write_template.html write_template.h write_template.cc for i in \ main \ load_events \ load_events_test \ string_pool \ string_pool_test \ unicode \ unicode_test \ write_events \ write_events_test \ write_template; do g++ $cflags -c $i.cc -o $i.o done # Link g++ $lflags main.o load_events.o string_pool.o unicode.o write_events.o write_template.o -o homura g++ $lflags load_events_test.o load_events.o unicode.o -o load_events_test g++ $lflags write_events_test.o write_events.o string_pool.o unicode.o write_template.o -o write_events_test g++ $lflags string_pool_test.o string_pool.o -o string_pool_test g++ $lflags unicode_test.o unicode.o -o unicode_test # Run ./main_test.sh ./load_events_test ./string_pool_test ./unicode_test ./write_events_test # Generate coverage data gcov \ main.cc \ load_events.cc \ load_events_test.cc \ string_pool.cc \ string_pool_test.cc \ unicode.cc \ unicode_test.cc \ write_events.cc \ write_events_test.cc