Attempt to reduce the memory used by VALUES clauses in as many statements as possible...
[sqlite.git] / tool / srctree-check.tcl
blob51226cda46e959088ea76f5ce8402ada7c441f8f
1 #!/usr/bin/tclsh
3 # Run this script from the top of the source tree in order to confirm that
4 # various aspects of the source tree are up-to-date. Items checked include:
6 # * Makefile.msc and autoconf/Makefile.msc agree
7 # * src/ctime.tcl is consistent with tool/mkctimec.tcl
8 # * VERSION agrees with autoconf/tea/configure.ac
9 # * src/pragma.h agrees with tool/mkpragmatab.tcl
11 # Other tests might be added later.
13 # Error messages are printed and the process exists non-zero if problems
14 # are found. If everything is ok, no output is generated and the process
15 # exits with 0.
18 # Read an entire file.
20 proc readfile {filename} {
21 set fd [open $filename rb]
22 set txt [read $fd]
23 close $fd
24 return $txt
27 # Find the root of the tree.
29 set ROOT [file dir [file dir [file normalize $argv0]]]
31 # Name of the TCL interpreter
33 set TCLSH [info nameofexe]
35 # Number of errors seen.
37 set NERR 0
39 ######################### configure ###########################################
41 set conf [readfile $ROOT/configure]
42 set vers [readfile $ROOT/VERSION]
43 if {[string first $vers $conf]<=0} {
44 puts "ERROR: ./configure does not agree with ./VERSION"
45 puts "...... Fix: run autoconf"
46 incr NERR
48 unset conf
50 ######################### autoconf/tea/configure.ac ###########################
52 set confac [readfile $ROOT/autoconf/tea/configure.ac]
53 set vers [readfile $ROOT/VERSION]
54 set pattern {AC_INIT([sqlite],[}
55 append pattern [string trim $vers]
56 append pattern {])}
57 if {[string first $pattern $confac]<=0} {
58 puts "ERROR: ./autoconf/tea/configure.ac does not agree with ./VERSION"
59 puts "...... Fix: manually edit ./autoconf/tea/configure.ac and put the"
60 puts "...... correct version number in AC_INIT()"
61 incr NERR
63 unset confac
65 ######################### autoconf/Makefile.msc ###############################
67 set f1 [readfile $ROOT/autoconf/Makefile.msc]
68 exec $TCLSH $ROOT/tool/mkmsvcmin.tcl $ROOT/Makefile.msc tmp1.txt
69 set f2 [readfile tmp1.txt]
70 file delete tmp1.txt
71 if {$f1 != $f2} {
72 puts "ERROR: ./autoconf/Makefile.msc does not agree with ./Makefile.msc"
73 puts "...... Fix: tclsh tool/mkmsvcmin.tcl"
74 incr NERR
77 ######################### src/pragma.h ########################################
79 set f1 [readfile $ROOT/src/pragma.h]
80 exec $TCLSH $ROOT/tool/mkpragmatab.tcl tmp2.txt
81 set f2 [readfile tmp2.txt]
82 file delete tmp2.txt
83 if {$f1 != $f2} {
84 puts "ERROR: ./src/pragma.h does not agree with ./tool/mkpragmatab.tcl"
85 puts "...... Fix: tclsh tool/mkpragmatab.tcl"
86 incr NERR
89 ######################### src/ctime.c ########################################
91 set f1 [readfile $ROOT/src/ctime.c]
92 exec $TCLSH $ROOT/tool/mkctimec.tcl tmp3.txt
93 set f2 [readfile tmp3.txt]
94 file delete tmp3.txt
95 if {$f1 != $f2} {
96 puts "ERROR: ./src/ctime.c does not agree with ./tool/mkctimec.tcl"
97 puts "..... Fix: tclsh tool/mkctimec.tcl"
98 incr NERR
101 # If any errors are seen, exit 1 so that the build will fail.
103 if {$NERR>0} {exit 1}