Commit 520eec42 authored by Rich Prohaska's avatar Rich Prohaska

test a method to increase coverage of utilities using a makefile to check exit codes

git-svn-id: file:///svn/tokudb@2157 c7de825b-a66e-492c-adef-691d508d4ae1
parent fab32871
......@@ -22,10 +22,15 @@ $(DBCXX):
clean:
rm -rf $(TARGETS) *.gcno *.gcda *.gcov *.db
check: $(TARGETS)
check: $(TARGETS) \
check_db_create_1 check_db_create_2 check_db_create_3 check_db_create_4
$(VGRIND) ./test1
$(VGRIND) ./test1e
rm -f foo.db
$(VGRIND) ./db_create -s main foo.db
rm -f foo.db
$(VGRIND) ./db_create -D -S -s main foo.db
rm -f foo.db
$(VGRIND) ./db_create foo.db a b c d
$(VGRIND) ./db_dump foo.db > foo.out
(echo " 61";echo " 62";echo " 63";echo " 64")>foo.expectout
......@@ -41,3 +46,12 @@ check: $(TARGETS)
$(VGRIND) ./test_error_stream
$(VGRIND) ./test_reverse_compare_fun
$(VGRIND) ./test_db_delete
check_db_create_1:
$(VGRIND) ./db_create; let exitcode=$$?; if [ $$exitcode -ne 0 ] ; then exit 0; else exit 1; fi
check_db_create_2:
$(VGRIND) ./db_create -h; let exitcode=$$?; if [ $$exitcode -ne 0 ] ; then exit 0; else exit 1; fi
check_db_create_3:
$(VGRIND) ./db_create --help; let exitcode=$$?; if [ $$exitcode -ne 0 ] ; then exit 0; else exit 1; fi
check_db_create_4:
$(VGRIND) ./db_create -s; let exitcode=$$?; if [ $$exitcode -ne 0 ] ; then exit 0; else exit 1; fi
#include <assert.h>
#include <db_cxx.h>
#define USE_ENV 1
int dbcreate(char *dbfile, char *dbname, int dbflags, int argc, char *argv[]) {
int r;
#if USE_ENV
......@@ -26,11 +28,13 @@ int dbcreate(char *dbfile, char *dbname, int dbflags, int argc, char *argv[]) {
}
r = db->close(0); assert(r == 0);
delete db;
#if USE_ENV
if (env) {
r = env->close(0); assert(r == 0);
delete env;
}
delete db;
#endif
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment