1#!/bin/sh -
2#
3# $Id: chk.codegen,v 1.4 2007/05/01 17:44:31 bostic Exp $
4#
5# Check to make sure that the db_codegen examples build and compile.
6
7d=../../db_codegen
8
9[ -d $d ] || {
10	echo 'FAIL: cannot find db_codegen source directory.'
11	exit 1
12}
13(cd .. && make db_codegen > /dev/null) || {
14	echo 'FAIL: unable to build db_codgen'
15	exit 1
16}
17
18for i in `find $d -name 'example[0-9]*'` ; do
19	echo "	example $i"
20	rm -rf BUILD && mkdir BUILD && cd BUILD
21	if ../../db_codegen -a c -i ../$i; then
22		:
23	else
24		echo "FAIL: failed to load $i"
25		exit 1
26	fi
27	if cc -DBUILD_STANDALONE -pthread \
28	    -Wall -Werror -I../.. application.c ../../libdb.a -o t; then
29		:
30	else
31		echo "FAIL: failed to compile $i"
32		exit 1
33	fi
34	if ./t ; then
35		:
36	else
37		echo "FAIL: failed to run $i"
38		exit 1
39	fi
40	cd ..
41done
42
43exit 0
44