mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 14:54:20 +01:00
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
This commit is contained in:
parent
fab328719f
commit
520eec42ce
2 changed files with 20 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue