summaryrefslogtreecommitdiff
path: root/db-4.8.30/test/scr021
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2016-12-17 21:28:53 -0800
committerJesse Morgan <jesse@jesterpm.net>2016-12-17 21:28:53 -0800
commit54df2afaa61c6a03cbb4a33c9b90fa572b6d07b8 (patch)
tree18147b92b969d25ffbe61935fb63035cac820dd0 /db-4.8.30/test/scr021
Berkeley DB 4.8 with rust build script for linux.
Diffstat (limited to 'db-4.8.30/test/scr021')
-rw-r--r--db-4.8.30/test/scr021/chk.flags174
-rw-r--r--db-4.8.30/test/scr021/t.c79
2 files changed, 253 insertions, 0 deletions
diff --git a/db-4.8.30/test/scr021/chk.flags b/db-4.8.30/test/scr021/chk.flags
new file mode 100644
index 0000000..89f669f
--- /dev/null
+++ b/db-4.8.30/test/scr021/chk.flags
@@ -0,0 +1,174 @@
+#!/bin/sh -
+#
+# $Id$
+#
+# Check flag name-spaces.
+
+d=../..
+t1=__1
+t2=__2
+
+if cc -g -Wall -I.. t.c -o t; then
+ :
+else
+ echo "FAIL: unable to compile test program t.c"
+ exit 1
+fi
+
+if ./t $d/*/*.[ch] $d/*/*.in > $t1; then
+ :
+else
+ echo "FAIL: test program failed"
+ exit 1
+fi
+
+echo 'Checking "dbenv" variables with flags other than DB_ENV_XXX'
+grep 'dbenv,' $t1 |
+sed -e '/DB_ENV_/d' \
+ -e '/env_method.c.*, mapped_flags*)/d' \
+ -e '/env_region.c.*, flags_orig*)/d' \
+ > $t2
+[ -s $t2 ] && {
+ cat $t2
+ exit 1
+}
+
+echo 'Checking DB_ENV_XXX flags with variables other than "dbenv"'
+grep 'DB_ENV_' $t1 |
+sed -e '/dbenv,/d' \
+ -e '/(dbenv),/d' \
+ > $t2
+[ -s $t2 ] && {
+ cat $t2
+ exit 1
+}
+
+echo 'Checking "env" variables with flags other than ENV_XXX'
+grep '[^b]env,' $t1 |
+sed -e '/[^B]ENV_/d' \
+ -e '/env_method.c.*, mapped_flags*)/d' \
+ > $t2
+[ -s $t2 ] && {
+ cat $t2
+ exit 1
+}
+
+echo 'Checking ENV_XXX flags with variables other than "env"'
+grep '[^A-Z_]ENV_' $t1 |
+sed -e '/[^b]env,/d' \
+ -e '/(env),/d' \
+ > $t2
+[ -s $t2 ] && {
+ cat $t2
+ exit 1
+}
+
+echo 'Checking dbenv "verbose" field with flags other than DB_VERB_XXX'
+grep -- 'dbenv->verbose,' $t1 |
+sed -e '/DB_VERB_/d' \
+ -e '/env_method.c.*, which)/d' \
+ > $t2
+[ -s $t2 ] && {
+ cat $t2
+ exit 1
+}
+
+echo 'Checking DB_VER_XXX flags with other than dbenv "verbose" field'
+grep -- 'DB_VERB_' $t1 |
+sed -e '/dbenv->verbose,/d' \
+ > $t2
+[ -s $t2 ] && {
+ cat $t2
+ exit 1
+}
+
+echo 'Checking "db" variables with flags other than DB_AM_XXX'
+cp $t1 /tmp/_f
+grep 'dbp,' $t1 |
+sed -e '/DB_AM_/d' \
+ -e '/dbp, mapped_flag)/d' \
+ > $t2
+[ -s $t2 ] && {
+ cat $t2
+ exit 1
+}
+
+echo 'Checking DB_AM_XXX flags with variables other than "db"'
+grep 'DB_AM_' $t1 |
+sed \
+ -e '/(&db,/d' \
+ -e '/(db,/d' \
+ -e '/_method.c:.*outflagsp,/d' \
+ -e '/partition.c:.*pdbp,/d' \
+ -e '/rep_backup.c:.*->flags,/d' \
+ -e /'rep_backup.c:.*->db_flags,/d' \
+ -e '/db.c:.*save_flags,/d' \
+ -e '/((*[ ]*db_rep->rep_db)*,/d' \
+ -e '/((*[ ]*dbc)*->dbp,/d' \
+ -e '/((*[ ]*dbc_arg->dbp)*,/d' \
+ -e '/((*[ ]*dbp)*,/d' \
+ -e '/((*[ ]*dbp)*->s_primary,/d' \
+ -e '/((D),/d' \
+ -e '/((sdbp),/d' \
+ -e '/(fdbp,/d' \
+ -e '/(file_dbp,/d' \
+ -e '/(ldbp,/d' \
+ -e '/(msgfp->db_flags,/d' \
+ -e '/(mdbp,/d' \
+ -e '/(pdbp,/d' \
+ -e '/(pginfo, /d' \
+ -e '/(rfp->db_flags,/d' \
+ -e '/(sdbp,/d' \
+ -e '/(subdbp,/d' \
+ -e '/fop_util.c:.*(t2dbp,/d' \
+ -e '/fop_util.c:.*(tmpdbp,/d' \
+ > $t2
+[ -s $t2 ] && {
+ cat $t2
+ exit 1
+}
+
+echo 'Checking "dbc" variables flags with flags other than DBC_XXX'
+echo Checking DBC flags...
+cat $t1 |
+grep 'dbc,' |
+sed -e '/DBC_/d' \
+ -e '/db_cam.c:.*tmp_read_locking)/d'
+ > $t2
+[ -s $t2 ] && {
+ cat $t2
+ exit 1
+}
+
+echo 'Checking DBC_XXX flags with variables other than "dbc"'
+grep 'DBC_' $t1 |
+sed -e '/((*dbc)*,/d' \
+ -e '/(dbc_arg,/d' \
+ -e '/(dbc_c,/d' \
+ -e '/(dbc_n,/d' \
+ -e '/(dbc_orig,/d' \
+ -e '/(opd,/d' \
+ -e '/(pdbc,/d' \
+ -e '/[(*]put_state[p]*,/d' \
+ -e '/(sdbc,/d' \
+ -e '/partition.c:.*_dbc,/d' \
+ -e '/partition.c:.*_cursor,/d'
+ > $t2
+[ -s $t2 ] && {
+ cat $t2
+ exit 1
+}
+
+echo Checking for bad use of macros...
+egrep 'case .*F_SET\(|case .*F_CLR\(' $d/*/*.c > $t1
+egrep 'for .*F_SET\(|for .*F_CLR\(' $d/*/*.c >> $t1
+egrep 'if .*F_SET\(|if .*F_CLR\(' $d/*/*.c >> $t1
+egrep 'switch .*F_SET\(|switch .*F_CLR\(' $d/*/*.c >> $t1
+egrep 'while .*F_SET\(|while .*F_CLR\(' $d/*/*.c >> $t1
+[ -s $t1 ] && {
+ echo 'if statement followed by non-test macro'
+ cat $t1
+ exit 1
+}
+
+exit 0
diff --git a/db-4.8.30/test/scr021/t.c b/db-4.8.30/test/scr021/t.c
new file mode 100644
index 0000000..046c2f2
--- /dev/null
+++ b/db-4.8.30/test/scr021/t.c
@@ -0,0 +1,79 @@
+/*-
+ * See the file LICENSE for redistribution information.
+ *
+ * Copyright (c) 2002-2009 Oracle. All rights reserved.
+ */
+
+#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(EXIT_FAILURE);
+ }
+
+ 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, "FLD_CLR(");
+ chk(*argv, "FLD_ISSET(");
+ chk(*argv, "FLD_SET(");
+ chk(*argv, "F_CLR(");
+ chk(*argv, "F_ISSET(");
+ chk(*argv, "F_SET(");
+ }
+ return (0);
+}