Finished a pass over all the non-SQLite derrived tests (which all

live in scr050) and brought them up to date, some minor fixes along
the way.  A few tests don't work properly, I've noted those in the
TODO file for some other time.
This commit is contained in:
Gregory Burd 2009-09-01 19:21:41 -04:00
parent 62311bde64
commit c39ba47f61
11 changed files with 183 additions and 140 deletions

18
TODO
View file

@ -9,11 +9,21 @@
Make sure that we're up to date with the latest in DB. Things such
as hashing, etc.
* Find printf/fprintf calls which print error messages
The library should never print messages unless configured to be
verbose.
* splint
Clean up all items pointed out by splint.
* makedepend
* valgrind
Fix all memory related bugs.
* review dbsql/dbsql.c
General clean-up including changing calls to malloc, free, etc to
__os_malloc, __os_free, etc.
* Review SQLite's latest lemon.c and lempar.c code
@ -23,3 +33,11 @@
This is now static in DB's code, so to hack the compile I commented
out the use of __os_sleep() in api.c
* test/scr026
This test has not been updated to check for DBSQL API calls rather
than DB API calls. Review and fix it.
* test/scr030
Update this test to match the configure script. Augment it so that
as the configure script changes the script reports options not tested.

View file

@ -15,6 +15,8 @@ d=../..
t1=__1
t2=__2
trap 'rm -f $t1 $t2' 0 1 2 3 13 15
egrep -- "define.*DBSQL_.*-509" $d/src/dbsql.in | awk '{print $2}' > $t1
sed -e '/^dbsql_strerror/,/^}/{' \
-e '/ case DBSQL_/{' \
@ -27,6 +29,6 @@ sed -e '/^dbsql_strerror/,/^}/{' \
< $d/src/common/dbsql_err.c > $t2
cmp $t1 $t2 > /dev/null ||
(echo "<<< db.h >>> db_strerror" && diff $t1 $t2 && exit 1)
(echo "<<< dbsql.h >>> db_strerror" && diff $t1 $t2 && exit 1)
exit 0

View file

@ -15,6 +15,60 @@ d=../..
exit 1
}
trap 'rm -f t t.c' 0 1 2 3 13 15
cat << END_OF_CODE > t.c
#include <sys/types.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
extern int isblank(int c);
int
chk(f)
char *f;
{
int ch, l, r;
if (freopen(f, "r", stdin) == NULL) {
fprintf(stderr, "%s: %s\n", f, strerror(errno));
exit (1);
}
for (l = 1, r = 0; (ch = getchar()) != EOF;) {
if (ch != ',')
goto next;
do { ch = getchar(); } while (isblank(ch));
if (ch != '\n')
goto next;
++l;
do { ch = getchar(); } while (isblank(ch));
if (ch != '}')
goto next;
r = 1;
printf("%s: line %d\n", f, l);
next: if (ch == '\n')
++l;
}
return (r);
}
int
main(int argc, char *argv[])
{
int r;
for (r = 0; *++argv != NULL;)
if (chk(*argv))
r = 1;
return (r);
}
END_OF_CODE
if cc -g -Wall -I.. t.c -o t; then
:
else

View file

@ -1,46 +0,0 @@
#include <sys/types.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <strings.h>
int
chk(f)
char *f;
{
int ch, l, r;
if (freopen(f, "r", stdin) == NULL) {
fprintf(stderr, "%s: %s\n", f, strerror(errno));
exit (1);
}
for (l = 1, r = 0; (ch = getchar()) != EOF;) {
if (ch != ',')
goto next;
do { ch = getchar(); } while (isblank(ch));
if (ch != '\n')
goto next;
++l;
do { ch = getchar(); } while (isblank(ch));
if (ch != '}')
goto next;
r = 1;
printf("%s: line %d\n", f, l);
next: if (ch == '\n')
++l;
}
return (r);
}
int
main(int argc, char *argv[])
{
int r;
for (r = 0; *++argv != NULL;)
if (chk(*argv))
r = 1;
return (r);
}

View file

@ -13,6 +13,8 @@ d=../..
t1=__1
t2=__2
trap 'rm -f $t1 $t2' 0 1 2 3 13 15
egrep -- '#include[ ]' $d/src/inc/dbsql_int.in |
sed -e '/[ ]db\.h'/d \
-e 's/^#include.//' \

View file

@ -13,6 +13,8 @@ d=../..
t1=__1
t2=__2
trap 'rm -f $t1 $t2' 0 1 2 3 13 15
(cd $d && find . -name '*.[chys]' -o -name '*.cpp' |
xargs egrep -l '#include.*dbsql_config.h') | tee /tmp/o > $t1

View file

@ -6,6 +6,81 @@ d=../..
t1=__1
t2=__2
trap 'rm -f $t1 $t2 t' 0 1 2 3 13 15
cat << END_OF_CODE > t.c
#include <sys/types.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void
chk(f, str)
char *f, *str;
{
char *s;
int ch, l, ok, pc;
if (freopen(f, "r", stdin) == NULL) {
fprintf(stderr, "%s: %s\n", f, strerror(errno));
exit (1);
}
for (l = 1, ok = 1, s = str; (ch = getchar()) != EOF;) {
if (ch == '\n')
++l;
if (!ok || ch != *s) {
s = str;
ok = !isalpha(ch) && !isdigit(ch) && ch != '_';
continue;
}
if (*++s != '\0')
continue;
/* Match. */
printf("%s: %d: %s", f, l, str);
for (pc = 1; (ch = getchar()) != EOF;) {
switch (ch) {
case '(':
++pc;
break;
case ')':
--pc;
break;
case '\n':
++l;
break;
}
if (ch == '\n')
putchar(' ');
else
putchar(ch);
if (pc <= 0) {
putchar('\n');
break;
}
}
s = str;
}
}
int
main(int argc, char *argv[])
{
int r;
for (r = 0; *++argv != NULL;) {
chk(*argv, "F_ISSET(");
chk(*argv, "F_CLR(");
chk(*argv, "F_SET(");
}
return (0);
}
END_OF_CODE
if cc -g -Wall -I.. t.c -o t; then
:
else

View file

@ -1,69 +0,0 @@
#include <sys/types.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <strings.h>
void
chk(f, str)
char *f, *str;
{
char *s;
int ch, l, ok, pc;
if (freopen(f, "r", stdin) == NULL) {
fprintf(stderr, "%s: %s\n", f, strerror(errno));
exit (1);
}
for (l = 1, ok = 1, s = str; (ch = getchar()) != EOF;) {
if (ch == '\n')
++l;
if (!ok || ch != *s) {
s = str;
ok = !isalpha(ch) && !isdigit(ch) && ch != '_';
continue;
}
if (*++s != '\0')
continue;
/* Match. */
printf("%s: %d: %s", f, l, str);
for (pc = 1; (ch = getchar()) != EOF;) {
switch (ch) {
case '(':
++pc;
break;
case ')':
--pc;
break;
case '\n':
++l;
break;
}
if (ch == '\n')
putchar(' ');
else
putchar(ch);
if (pc <= 0) {
putchar('\n');
break;
}
}
s = str;
}
}
int
main(int argc, char *argv[])
{
int r;
for (r = 0; *++argv != NULL;) {
chk(*argv, "F_ISSET(");
chk(*argv, "F_CLR(");
chk(*argv, "F_SET(");
}
return (0);
}

View file

@ -1,25 +1,26 @@
#!/bin/sh -
#
# Check for DB_RUNRECOVERY being specified instead of a call
# to dbsql_panic.
# Check for DB_RUNRECOVERY being specified instead of a call to dbsql_panic.
d=../..
t1=__1
egrep DB_RUNRECOVERY $d/*/*.c |
sed -e '/__db_panic(.*, DB_RUNRECOVERY)/d' \
-e '/case DB_RUNRECOVERY:/d' \
-e '/db_dispatch.c:.*if (ret == DB_RUNRECOVERY/d' \
trap 'rm -f $t1' 0 1 2 3 13 15
egrep DBSQL_RUNRECOVERY $d/*/*.c $d/*/*/*.c |
sed -e '/__db_panic(.*, DBSQL_RUNRECOVERY)/d' \
-e '/case DBSQL_RUNRECOVERY:/d' \
-e '/db_dispatch.c:.*if (ret == DBSQL_RUNRECOVERY/d' \
-e '/db_err.c:/d' \
-e '/os_errno.c:.*evalue == DB_RUNRECOVERY/d' \
-e '/os_errno.c:.*evalue == DBSQL_RUNRECOVERY/d' \
-e '/\/php_db4\//d' \
-e '/rep_backup.c:.*Panic the env and return DB_RUNRECOVERY/d' \
-e '/txn.c:.* \* DB_RUNRECOVERY and we need to/d' \
-e '/txn.c:.*returned DB_RUNRECOVERY and we need to/d' \
-e '/rep_backup.c:.*Panic the env and return DBSQL_RUNRECOVERY/d' \
-e '/txn.c:.* \* DBSQL_RUNRECOVERY and we need to/d' \
-e '/txn.c:.*returned DBSQL_RUNRECOVERY and we need to/d' \
> $t1
[ -s $t1 ] && {
echo "DB_RUNRECOVERY used; should be a call to dbsql_panic."
echo "DBSQL_RUNRECOVERY used; should be a call to dbsql_panic."
cat $t1
exit 1
}

View file

@ -4,7 +4,9 @@
d=../..
t=__1
t1=__1
trap 'rm -f $t1' 0 1 2 3 13 15
echo ============================================================
echo "Check that DBSQL doesn't call DBSQL_ENV methods internally."
@ -80,10 +82,10 @@ sed \
-e '/db_iface.c:.*if ((t_ret = txn->abort(txn)) != 0)/d' \
-e '/db_iface.c:.*return (dbenv->txn_begin(dbenv, NULL, txnidp, 0));/d' \
-e '/rep_util.c:.*ret = dbenv->rep_send(dbenv, &cdbt, dbtp, &cntrl.lsn,/d' \
>$t
>$t1
test -s $t && {
cat $t
test -s $t1 && {
cat $t1
echo "FAIL: found DB/DB_ENV method calls DB library."
exit 1
}

View file

@ -2,8 +2,10 @@
#
# Build a program that calls the run-time API configuration functions.
trap 'rm -rf scr030 ; exit 0' 0
trap 'rm -rf scr030 ; exit 1' 1 2 3 13 15
t=__1
trap 'rm -rf $t ; exit 0' 0
trap 'rm -rf $t ; exit 1' 1 2 3 13 15
[ -d ../../dist ] || {
echo 'FAIL: unable to find top-level dist directory'
@ -38,9 +40,9 @@ s="\
r()
{
echo "run: $1 (`date`)"
rm -rf scr030
mkdir scr030
cd scr030
rm -rf $t
mkdir $t
cd $t
../../../dist/configure $1 > config.OUT 2>&1
if test $? -ne 0; then
echo "$i: FAILED in configure"
@ -67,7 +69,7 @@ r()
exit 1
fi
cd ..
rm -rf scr030
rm -rf $t
}
# Run through all of the standard single options.