/ Check-in [809d67b6]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add json1.c to the fuzzer test shells.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 809d67b61164b83bbb6962f0edee1793a483ccab
User & Date: drh 2015-09-19 16:51:58
Context
2015-09-19
18:08
Fix compiler warnings. check-in: 5c31ee62 user: drh tags: trunk
16:51
Add json1.c to the fuzzer test shells. check-in: 809d67b6 user: drh tags: trunk
16:45
Adjust Makefiles to use SQLITE_CORE when statically linking json1.c into test shells. Closed-Leaf check-in: 91682ac3 user: drh tags: json-fuzz
12:04
Fix a documentation typo in sqlite3_bind_parameter_index(). No code changes. check-in: 650605a8 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.in.

   536    536   # Databases containing fuzzer test cases
   537    537   #
   538    538   FUZZDATA = \
   539    539     $(TOP)/test/fuzzdata1.db \
   540    540     $(TOP)/test/fuzzdata2.db \
   541    541     $(TOP)/test/fuzzdata3.db
   542    542   
          543  +# Extra arguments for including json1 in the build of tools
          544  +#
          545  +JSON1_DEP = $(TOP)/ext/misc/json1.c sqlite3ext.h
          546  +JSON1_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_CORE
          547  +JSON1_SRC = $(TOP)/ext/misc/json1.c
          548  +
   543    549   # Standard options to testfixture
   544    550   #
   545    551   TESTOPTS = --verbose=file --output=test-out.txt
   546    552   
   547    553   # This is the default Makefile target.  The objects listed here
   548    554   # are what get build when you type just "make" with no arguments.
   549    555   #
................................................................................
   562    568   libtclsqlite3.la:	tclsqlite.lo libsqlite3.la
   563    569   	$(LTLINK) -no-undefined -o $@ tclsqlite.lo \
   564    570   		libsqlite3.la @TCL_STUB_LIB_SPEC@ $(TLIBS) \
   565    571   		-rpath "$(TCLLIBDIR)" \
   566    572   		-version-info "8:6:8" \
   567    573   		-avoid-version
   568    574   
   569         -sqlite3$(TEXE):	$(TOP)/src/shell.c libsqlite3.la sqlite3.h $(TOP)/ext/misc/json1.c
   570         -	$(LTLINK) $(READLINE_FLAGS) -DSQLITE_ENABLE_JSON1 -o $@ \
   571         -		$(TOP)/src/shell.c $(TOP)/ext/misc/json1.c libsqlite3.la \
          575  +sqlite3$(TEXE):	$(TOP)/src/shell.c libsqlite3.la sqlite3.h $(JSON1_DEP)
          576  +	$(LTLINK) $(READLINE_FLAGS) $(JSON1_OPT) -o $@ \
          577  +		$(TOP)/src/shell.c $(JSON1_SRC) libsqlite3.la \
   572    578   		$(LIBREADLINE) $(TLIBS) -rpath "$(libdir)"
   573    579   
   574    580   sqldiff$(TEXE):	$(TOP)/tool/sqldiff.c sqlite3.c sqlite3.h
   575    581   	$(LTLINK) -o $@ $(TOP)/tool/sqldiff.c sqlite3.c $(TLIBS)
   576    582   
   577         -fuzzershell$(TEXE):	$(TOP)/tool/fuzzershell.c sqlite3.c sqlite3.h
   578         -	$(LTLINK) -o $@ $(TOP)/tool/fuzzershell.c sqlite3.c $(TLIBS)
          583  +fuzzershell$(TEXE):	$(TOP)/tool/fuzzershell.c sqlite3.c sqlite3.h $(JSON1_DEP)
          584  +	$(LTLINK) -o $@ $(JSON1_OPT) \
          585  +	  $(TOP)/tool/fuzzershell.c $(JSON1_SRC) sqlite3.c $(TLIBS)
   579    586   
   580         -fuzzcheck$(TEXE):	$(TOP)/test/fuzzcheck.c sqlite3.c sqlite3.h
   581         -	$(LTLINK) -o $@ $(TOP)/test/fuzzcheck.c sqlite3.c $(TLIBS)
          587  +fuzzcheck$(TEXE):	$(TOP)/test/fuzzcheck.c sqlite3.c sqlite3.h $(JSON1_DEP)
          588  +	$(LTLINK) -o $@ $(JSON1_OPT) $(TOP)/test/fuzzcheck.c $(JSON1_SRC) sqlite3.c $(TLIBS)
   582    589   
   583    590   mptester$(TEXE):	sqlite3.c $(TOP)/mptest/mptest.c
   584    591   	$(LTLINK) -o $@ -I. $(TOP)/mptest/mptest.c sqlite3.c \
   585    592   		$(TLIBS) -rpath "$(libdir)"
   586    593   
   587    594   MPTEST1=./mptester$(TEXE) mptest.db $(TOP)/mptest/crash01.test --repeat 20
   588    595   MPTEST2=./mptester$(TEXE) mptest.db $(TOP)/mptest/multiwrite01.test --repeat 20

Changes to Makefile.msc.

  1205   1205   # Databases containing fuzzer test cases
  1206   1206   #
  1207   1207   FUZZDATA = \
  1208   1208     $(TOP)\test\fuzzdata1.db \
  1209   1209     $(TOP)\test\fuzzdata2.db \
  1210   1210     $(TOP)\test\fuzzdata3.db
  1211   1211   
         1212  +# Extra arguments for including json1 in the build of tools
         1213  +#
         1214  +JSON1_DEP = $(TOP)\ext\misc\json1.c sqlite3ext.h
         1215  +JSON1_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_CORE
         1216  +JSON1_SRC = $(TOP)\ext\misc\json1.c
         1217  +
  1212   1218   # Standard options to testfixture
  1213   1219   #
  1214   1220   TESTOPTS = --verbose=file --output=test-out.txt
  1215   1221   
  1216   1222   # This is the default Makefile target.  The objects listed here
  1217   1223   # are what get build when you type just "make" with no arguments.
  1218   1224   #
................................................................................
  1220   1226   
  1221   1227   libsqlite3.lib:	$(LIBOBJ)
  1222   1228   	$(LTLIB) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(TLIBS)
  1223   1229   
  1224   1230   libtclsqlite3.lib:	tclsqlite.lo libsqlite3.lib
  1225   1231   	$(LTLIB) $(LTLIBOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCL:tcl=tclstub) $(TLIBS)
  1226   1232   
  1227         -sqlite3.exe:	$(TOP)\src\shell.c $(TOP)\ext\misc\json1.c $(SHELL_CORE_DEP) $(LIBRESOBJS) sqlite3.h
  1228         -	$(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) $(TOP)\src\shell.c $(TOP)\ext\misc\json1.c \
         1233  +sqlite3.exe:	$(TOP)\src\shell.c $(JSON1_DEP) $(SHELL_CORE_DEP) $(LIBRESOBJS) sqlite3.h
         1234  +	$(LTLINK) $(SHELL_COMPILE_OPTS) $(JSON1_OPT) $(READLINE_FLAGS) $(TOP)\src\shell.c $(JSON1_SRC) \
  1229   1235   		/link /pdb:sqlite3sh.pdb $(LTLINKOPTS) $(SHELL_LINK_OPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
  1230   1236   
  1231   1237   sqldiff.exe:	$(TOP)\tool\sqldiff.c sqlite3.c sqlite3.h
  1232   1238   	$(LTLINK) $(NO_WARN) $(TOP)\tool\sqldiff.c sqlite3.c
  1233   1239   
  1234         -fuzzershell.exe:	$(TOP)\tool\fuzzershell.c sqlite3.c sqlite3.h
  1235         -	$(LTLINK) $(NO_WARN) $(TOP)\tool\fuzzershell.c sqlite3.c
         1240  +fuzzershell.exe:	$(TOP)\tool\fuzzershell.c sqlite3.c sqlite3.h $(JSON1_DEP)
         1241  +	$(LTLINK) $(NO_WARN) $(JSON1_OPT) \
         1242  +	  $(TOP)\tool\fuzzershell.c $(JSON1_SRC) sqlite3.c
  1236   1243   
  1237         -fuzzcheck.exe:	$(TOP)\test\fuzzcheck.c sqlite3.c sqlite3.h
  1238         -	$(LTLINK) $(NO_WARN) $(TOP)\test\fuzzcheck.c sqlite3.c
         1244  +fuzzcheck.exe:	$(TOP)\test\fuzzcheck.c sqlite3.c sqlite3.h $(JSON1_DEP)
         1245  +	$(LTLINK) $(NO_WARN) $(JSON1_OPT) $(TOP)\test\fuzzcheck.c $(JSON1_SRC) sqlite3.c
  1239   1246   
  1240   1247   mptester.exe:	$(TOP)\mptest\mptest.c $(SHELL_CORE_DEP) $(LIBRESOBJS) sqlite3.h
  1241   1248   	$(LTLINK) $(NO_WARN) $(SHELL_COMPILE_OPTS) $(TOP)\mptest\mptest.c \
  1242   1249   		/link $(LTLINKOPTS) $(LTLIBPATHS) $(SHELL_LINK_OPTS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
  1243   1250   
  1244   1251   MPTEST1 = mptester mptest.db $(TOP)\mptest\crash01.test --repeat 20
  1245   1252   MPTEST2 = mptester mptest.db $(TOP)\mptest\multiwrite01.test --repeat 20

Changes to main.mk.

   446    446   # Databases containing fuzzer test cases
   447    447   #
   448    448   FUZZDATA = \
   449    449     $(TOP)/test/fuzzdata1.db \
   450    450     $(TOP)/test/fuzzdata2.db \
   451    451     $(TOP)/test/fuzzdata3.db
   452    452   
          453  +# Extra arguments for including json1 in the build of tools
          454  +#
          455  +JSON1_DEP = $(TOP)/ext/misc/json1.c sqlite3ext.h
          456  +JSON1_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_CORE
          457  +JSON1_SRC = $(TOP)/ext/misc/json1.c
          458  +
   453    459   # Standard options to testfixture
   454    460   #
   455    461   TESTOPTS = --verbose=file --output=test-out.txt
   456    462   
   457    463   # This is the default Makefile target.  The objects listed here
   458    464   # are what get build when you type just "make" with no arguments.
   459    465   #
   460    466   all:	sqlite3.h libsqlite3.a sqlite3$(EXE)
   461    467   
   462    468   libsqlite3.a:	$(LIBOBJ)
   463    469   	$(AR) libsqlite3.a $(LIBOBJ)
   464    470   	$(RANLIB) libsqlite3.a
   465    471   
   466         -sqlite3$(EXE):	$(TOP)/src/shell.c libsqlite3.a sqlite3.h $(TOP)/ext/misc/json1.c
   467         -	$(TCCX) $(READLINE_FLAGS) -DSQLITE_ENABLE_JSON1 -o sqlite3$(EXE)  \
   468         -		$(TOP)/src/shell.c $(TOP)/ext/misc/json1.c                \
          472  +sqlite3$(EXE):	$(TOP)/src/shell.c libsqlite3.a sqlite3.h $(JSON1_DEP)
          473  +	$(TCCX) $(READLINE_FLAGS) $(JSON1_OPT) -o sqlite3$(EXE)  \
          474  +		$(TOP)/src/shell.c $(JSON1_SRC) \
   469    475   		libsqlite3.a $(LIBREADLINE) $(TLIBS) $(THREADLIB)
   470    476   
   471    477   sqldiff$(EXE):	$(TOP)/tool/sqldiff.c sqlite3.c sqlite3.h
   472    478   	$(TCCX) -o sqldiff$(EXE) -DSQLITE_THREADSAFE=0 \
   473    479   		$(TOP)/tool/sqldiff.c sqlite3.c $(TLIBS) $(THREADLIB)
   474    480   
   475         -fuzzershell$(EXE):	$(TOP)/tool/fuzzershell.c sqlite3.c sqlite3.h
          481  +fuzzershell$(EXE):	$(TOP)/tool/fuzzershell.c sqlite3.c sqlite3.h $(JSON1_DEP)
   476    482   	$(TCCX) -o fuzzershell$(EXE) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION \
   477         -		$(TOP)/tool/fuzzershell.c sqlite3.c $(TLIBS) $(THREADLIB)
          483  +	  $(JSON1_OPT)	$(TOP)/tool/fuzzershell.c $(JSON1_SRC) sqlite3.c \
          484  +	  $(TLIBS) $(THREADLIB)
   478    485   
   479         -fuzzcheck$(EXE):	$(TOP)/test/fuzzcheck.c sqlite3.c sqlite3.h
          486  +fuzzcheck$(EXE):	$(TOP)/test/fuzzcheck.c sqlite3.c sqlite3.h $(JSON1_DEP)
   480    487   	$(TCCX) -o fuzzcheck$(EXE) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION \
   481         -		-DSQLITE_ENABLE_MEMSYS5 \
   482         -		$(TOP)/test/fuzzcheck.c sqlite3.c $(TLIBS) $(THREADLIB)
          488  +		-DSQLITE_ENABLE_MEMSYS5 $(JSON1_OPT) \
          489  +		$(TOP)/test/fuzzcheck.c $(JSON1_SRC) sqlite3.c $(TLIBS) $(THREADLIB)
   483    490   
   484    491   mptester$(EXE):	sqlite3.c $(TOP)/mptest/mptest.c
   485    492   	$(TCCX) -o $@ -I. $(TOP)/mptest/mptest.c sqlite3.c \
   486    493   		$(TLIBS) $(THREADLIB)
   487    494   
   488    495   MPTEST1=./mptester$(EXE) mptest.db $(TOP)/mptest/crash01.test --repeat 20
   489    496   MPTEST2=./mptester$(EXE) mptest.db $(TOP)/mptest/multiwrite01.test --repeat 20

Changes to test/fuzzcheck.c.

  1035   1035           openFlags = SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE;
  1036   1036           if( nativeFlag && pDb->sz==0 ){
  1037   1037             openFlags |= SQLITE_OPEN_MEMORY;
  1038   1038             zVfs = 0;
  1039   1039           }
  1040   1040           rc = sqlite3_open_v2("main.db", &db, openFlags, zVfs);
  1041   1041           if( rc ) fatalError("cannot open inmem database");
         1042  +#ifdef SQLITE_ENABLE_JSON1
         1043  +        {
         1044  +          extern int sqlite3_json_init(sqlite3*);
         1045  +          sqlite3_json_init(db);
         1046  +        }
         1047  +#endif
  1042   1048           if( cellSzCkFlag ) runSql(db, "PRAGMA cell_size_check=ON", runFlags);
  1043   1049           setAlarm(iTimeout);
  1044   1050   #ifndef SQLITE_OMIT_PROGRESS_CALLBACK
  1045   1051           if( sqlFuzz || vdbeLimitFlag ){
  1046   1052             sqlite3_progress_handler(db, 100000, progressHandler, &vdbeLimitFlag);
  1047   1053           }
  1048   1054   #endif

Changes to tool/fuzzershell.c.

   716    716           if( pLook ){
   717    717             rc = sqlite3_db_config(db, SQLITE_DBCONFIG_LOOKASIDE,pLook,szLook,nLook);
   718    718             if( rc!=SQLITE_OK ) abendError("lookaside configuration filed: %d", rc);
   719    719           }
   720    720       #ifndef SQLITE_OMIT_TRACE
   721    721           sqlite3_trace(db, verboseFlag ? traceCallback : traceNoop, 0);
   722    722       #endif
          723  +#ifdef SQLITE_ENABLE_JSON1
          724  +        {
          725  +          extern int sqlite3_json_init(sqlite3*);
          726  +          sqlite3_json_init(db);
          727  +        }
          728  +#endif
   723    729           sqlite3_create_function(db, "eval", 1, SQLITE_UTF8, 0, sqlEvalFunc, 0, 0);
   724    730           sqlite3_create_function(db, "eval", 2, SQLITE_UTF8, 0, sqlEvalFunc, 0, 0);
   725    731           sqlite3_limit(db, SQLITE_LIMIT_LENGTH, 1000000);
   726    732           if( zEncoding ) sqlexec(db, "PRAGMA encoding=%s", zEncoding);
   727    733           if( pageSize ) sqlexec(db, "PRAGMA pagesize=%d", pageSize);
   728    734           if( doAutovac ) sqlexec(db, "PRAGMA auto_vacuum=FULL");
   729    735           iStart = timeOfDay();