Have SConsignFile() use a dblite.py module by default, so we can control the behavior...
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 25 Apr 2004 19:47:31 +0000 (19:47 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 25 Apr 2004 19:47:31 +0000 (19:47 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@959 fdb21ef1-2011-0410-befe-b5e4ea1792b1

12 files changed:
doc/man/scons.1
src/CHANGES.txt
src/RELEASE.txt
src/engine/MANIFEST.in
src/engine/SCons/Environment.py
src/engine/SCons/EnvironmentTests.py
src/engine/SCons/Sig/SigTests.py
src/engine/SCons/Sig/__init__.py
src/engine/SCons/dblite.py [new file with mode: 0644]
src/script/sconsign.py
test/SConsignFile.py
test/sconsign-script.py

index a264d7c6a380177e8be1298dee90db69051b8804..e1bcf516866b0c1011d60a70aa9db792c477daf2 100644 (file)
@@ -3368,17 +3368,11 @@ The optional
 .I dbm_module
 argument can be used to specify
 which Python database module
-The default is to use
-.B dumbdbm
-if the specified
-.I file
-does not already exist,
-and to use
-.B anydbm
-to auto-detect the database format
-if the
-.I file
-already exists.
+The default is to use a custom
+.B SCons.dblite
+module that uses pickled
+Python data structures,
+and which works on all Python versions from 1.5.2 on.
 
 Examples:
 
index 0d28a0a547ba941aea6dcb9188c20cf1aa775796..bba15e73e237d599f025795a3e7f2039c200381c 100644 (file)
@@ -40,6 +40,11 @@ RELEASE 0.96 - XXX
 
   - Allow the Java() Builder to take more than one source directory.
 
+  From Ralf W. Grosse-Kunstleve:
+
+  - Have SConsignFile() use, by default, a custom "dblite.py" that we can
+    control and guarantee to work on all Python versions (or nearly so).
+
   From Bob Halley:
 
   - Make the new *FLAGS variable type work with copied Environments.
index 09a3d6fe0eae708fbaa39dda902e800ecc8205f4..c7b46fdd86c2bd57a5277adc623a9259bda2156a 100644 (file)
@@ -27,6 +27,16 @@ RELEASE 0.96 - XXX
 
   Please note the following important changes since release 0.95:
 
+    - The SConsignFile() function now uses an internally-supplied
+      SCons.dblite module as the default DB scheme for the .sconsign file.
+      If you are using the SConsignFile() function without an explicitly
+      specified dbm_module argument, this will cause all of your targets
+      to be recompiled the first time you use SCons 0.96.  To preserve the
+      previous behavior, specify the "anydbm" module explicitly:
+
+          import anydbm
+          SConsignFile('.sconsign_file_name', anydbm)
+
     - The internal Scanner.add_skey() method longer works for the default
       scanners, which now use construction variables to hold their lists
       of suffixes.  If you had a custom Tool specification that was
index a8bac0a2cc6d457546d8a5ce873f18e5393ac716..4942be8067ef31bbd1c04fb7546dce6bc26a2690 100644 (file)
@@ -2,6 +2,7 @@ SCons/__init__.py
 SCons/Action.py
 SCons/Builder.py
 SCons/Conftest.py
+SCons/dblite.py
 SCons/Debug.py
 SCons/Defaults.py
 SCons/Environment.py
index c312f310c50580f64586d50edd924401072d2508..d214e9be4a9a625ad83f8cdde9474bf33c630f1a 100644 (file)
@@ -1153,7 +1153,7 @@ class Base:
         nkw = self.subst_kw(kw)
         return apply(SCons.Scanner.Base, nargs, nkw)
 
-    def SConsignFile(self, name=".sconsign.dbm", dbm_module=None):
+    def SConsignFile(self, name=".sconsign", dbm_module=None):
         name = self.subst(name)
         if not os.path.isabs(name):
             name = os.path.join(str(self.fs.SConstruct_dir), name)
index 0995a053fc049023f35494e15543885c52fdaa36..d141d497ffdacc4d19056fa2995972215062dbba 100644 (file)
@@ -2245,6 +2245,10 @@ class EnvironmentTestCase(unittest.TestCase):
             env.SConsignFile('__$BAR', 7)
             assert fnames[4] == os.path.join(os.sep, 'dir', '__', 'File'), fnames
             assert dbms[4] == 7, dbms
+
+            env.SConsignFile()
+            assert fnames[5] == os.path.join(os.sep, 'dir', '.sconsign'), fnames
+            assert dbms[5] == None, dbms
         finally:
             SCons.Sig.SConsignFile = save_Sig_SConsignFile
 
index 98465fffe9983a1b07f7ad65f9e721b98b6fb45f..76cd931fffa5dd33f1bb74a235a906291df6bc83 100644 (file)
@@ -502,7 +502,7 @@ class SConsignFileTestCase(unittest.TestCase):
 
         SCons.Sig.SConsignFile(file)
 
-        assert not SCons.Sig.SConsign_db is None, SCons.Sig.SConsign_db
+        assert not SCons.Sig.SConsign_db is SCons.dblite, SCons.Sig.SConsign_db
 
         class Fake_DBM:
             def open(self, name, mode):
index d70319467a573496ca2e016233c8b83fad6f4cb2..6bdfe099e28d90cb9589858981cb6ecb4305170e 100644 (file)
@@ -326,8 +326,8 @@ def SConsignFile(name, dbm_module=None):
     global SConsign_db
     if SConsign_db is None:
         if dbm_module is None:
-            import anydbm
-            dbm_module = anydbm
+            import SCons.dblite
+            dbm_module = SCons.dblite
         SConsign_db = dbm_module.open(name, "c")
 
     global SConsignForDirectory
diff --git a/src/engine/SCons/dblite.py b/src/engine/SCons/dblite.py
new file mode 100644 (file)
index 0000000..df04d80
--- /dev/null
@@ -0,0 +1,149 @@
+# dblite.py module contributed by Ralf W. Grosse-Kunstleve.
+
+import cPickle
+import time
+import shutil
+import os
+import __builtin__
+
+_open = __builtin__.open # avoid name clash
+
+keep_all_files = 00000
+ignore_corrupt_dbfiles = 0
+
+class dblite:
+
+  def __init__(self, file_base_name, flag, mode):
+    assert flag in (None, "r", "w", "c", "n")
+    if (flag is None): flag = "r"
+    if file_base_name[-7:] != '.dblite':
+        file_base_name = file_base_name + '.dblite'
+    self._file_name = file_base_name
+    self._flag = flag
+    self._mode = mode
+    self._dict = {}
+    self._needs_sync = 00000
+    if (self._flag == "n"):
+      _open(self._file_name, "wb", self._mode)
+    else:
+      try:
+        f = _open(self._file_name, "rb")
+      except IOError, e:
+        if (self._flag != "c"):
+          raise e
+        _open(self._file_name, "wb", self._mode)
+      else:
+        p = f.read()
+        if (len(p) > 0):
+          try:
+            self._dict = cPickle.loads(p)
+          except:
+            if (ignore_corrupt_dbfiles == 0): raise
+            if (ignore_corrupt_dbfiles == 1):
+              print "Warning: Discarding corrupt database:", self._file_name
+
+  def __del__(self):
+    if (self._needs_sync):
+      self.sync()
+
+  def sync(self):
+    self._check_writable()
+    f = _open(self._file_name, "wb", self._mode)
+    cPickle.dump(self._dict, f, 1)
+    f.close()
+    self._needs_sync = 00000
+    if (keep_all_files):
+      shutil.copyfile(
+        self._file_name,
+        self._file_name + "_" + str(int(time.time())))
+
+  def _check_writable(self):
+    if (self._flag == "r"):
+      raise IOError("Read-only database: %s" % self._file_name)
+
+  def __getitem__(self, key):
+    return self._dict[key]
+
+  def __setitem__(self, key, value):
+    self._check_writable()
+    if (type(key) != type("")):
+      raise TypeError, "key must be a string"
+    if (type(value) != type("")):
+      raise TypeError, "value must be a string"
+    self._dict[key] = value
+    self._needs_sync = 0001
+
+  def keys(self):
+    return self._dict.keys()
+
+  def has_key(self, key):
+    return key in self._dict
+
+  def __contains__(self, key):
+    return key in self._dict
+
+  def iterkeys(self):
+    return self._dict.iterkeys()
+
+  __iter__ = iterkeys
+
+  def __len__(self):
+    return len(self._dict)
+
+def open(file, flag=None, mode=0666):
+  return dblite(file, flag, mode)
+
+def _exercise():
+  db = open("tmp", "n")
+  assert len(db) == 0
+  db["foo"] = "bar"
+  assert db["foo"] == "bar"
+  db.sync()
+  db = open("tmp", "c")
+  assert len(db) == 1
+  assert db["foo"] == "bar"
+  db["bar"] = "foo"
+  assert db["bar"] == "foo"
+  db.sync()
+  db = open("tmp", "r")
+  assert len(db) == 2
+  assert db["foo"] == "bar"
+  assert db["bar"] == "foo"
+  try:
+    db.sync()
+  except IOError, e:
+    assert str(e) == "Read-only database: tmp.dblite"
+  else:
+    raise RuntimeError, "IOError expected."
+  db = open("tmp", "w")
+  assert len(db) == 2
+  db["ping"] = "pong"
+  db.sync()
+  db = open("tmp", "r")
+  assert len(db) == 3
+  db = open("tmp", "n")
+  assert len(db) == 0
+  _open("tmp.dblite", "w")
+  db = open("tmp", "r")
+  _open("tmp.dblite", "w").write("x")
+  try:
+    db = open("tmp", "r")
+  except cPickle.UnpicklingError:
+    pass
+  else:
+    raise RuntimeError, "cPickle exception expected."
+  global ignore_corrupt_dbfiles
+  ignore_corrupt_dbfiles = 2
+  db = open("tmp", "r")
+  assert len(db) == 0
+  os.unlink("tmp.dblite")
+  try:
+    db = open("tmp", "w")
+  except IOError, e:
+    assert str(e) == "Database does not exist: tmp.dblite"
+  else:
+    raise RuntimeError, "IOError expected."
+  print "OK"
+
+if (__name__ == "__main__"):
+  _exercise()
index 1c0a7694943a64548015e6ffd68258b106f55559..e3905ce08e359514ff85573652fc8f401f43ed86 100644 (file)
@@ -141,13 +141,42 @@ sys.path = libs + sys.path
 # END STANDARD SCons SCRIPT HEADER
 ##############################################################################
 
+import cPickle
+import imp
+import string
+import whichdb
+
+import SCons.Sig
+
+def my_whichdb(filename):
+    try:
+        f = open(filename + ".dblite", "rb")
+        f.close()
+        return "SCons.dblite"
+    except IOError:
+        pass
+    return _orig_whichdb(filename)
+
+_orig_whichdb = whichdb.whichdb
+whichdb.whichdb = my_whichdb
+
+def my_import(mname):
+    if '.' in mname:
+        i = string.rfind(mname, '.')
+        parent = my_import(mname[:i])
+        fp, pathname, description = imp.find_module(mname[i+1:],
+                                                    parent.__path__)
+    else:
+        fp, pathname, description = imp.find_module(mname)
+    return imp.load_module(mname, fp, pathname, description)
+
 PF_bsig      = 0x1
 PF_csig      = 0x2
 PF_timestamp = 0x4
 PF_implicit  = 0x8
 PF_all       = PF_bsig | PF_csig | PF_timestamp | PF_implicit
 
-Do_Func = None
+Do_Call = None
 Print_Directories = []
 Print_Entries = []
 Print_Flags = 0
@@ -192,38 +221,63 @@ def printentries(entries):
         for name, e in entries.items():
             printfield(name, e)
 
-import SCons.Sig
+class Do_SConsignDB:
+    def __init__(self, dbm_name, dbm):
+        self.dbm_name = dbm_name
+        self.dbm = dbm
 
-def Do_SConsignDB(name):
-    import anydbm
-    import cPickle
-    try:
-        open(name, 'rb')
-    except (IOError, OSError), e:
-        sys.stderr.write("sconsign: %s\n" % (e))
-        return
-    try:
-        db = anydbm.open(name, "r")
-    except anydbm.error, e:
-        sys.stderr.write("sconsign: ignoring invalid .sconsign.dbm file `%s': %s\n" % (name, e))
-        return
-    if Print_Directories:
-        for dir in Print_Directories:
+    def __call__(self, fname):
+        # The *dbm modules stick their own file suffixes on the names
+        # that are passed in.  This is causes us to jump through some
+        # hoops here to be able to allow the user
+        try:
+            # Try opening the specified file name.  Example:
+            #   SPECIFIED                  OPENED BY self.dbm.open()
+            #   ---------                  -------------------------
+            #   .sconsign               => .sconsign.dblite
+            #   .sconsign.dblite        => .sconsign.dblite.dblite
+            db = self.dbm.open(fname, "r")
+        except (IOError, OSError), e:
+            print_e = e
             try:
-                val = db[dir]
-            except KeyError:
-                sys.stderr.write("sconsign: no dir `%s' in `%s'\n" % (dir, args[0]))
-            else:
-                entries = cPickle.loads(val)
-                print '=== ' + dir + ':'
-                printentries(entries)
-    else:
-        keys = db.keys()
-        keys.sort()
-        for dir in keys:
-            entries = cPickle.loads(db[dir])
-            print '=== ' + dir + ':'
-            printentries(entries)
+                # That didn't work, so try opening the base name,
+                # so that if the actually passed in 'sconsign.dblite'
+                # (for example), the dbm module will put the suffix back
+                # on for us and open it anyway.
+                db = self.dbm.open(os.path.splitext(fname)[0], "r")
+            except (IOError, OSError):
+                # That didn't work either.  See if the file name
+                # they specified just exists (independent of the dbm
+                # suffix-mangling).
+                try:
+                    open(fname, "r")
+                except (IOError, OSError), e:
+                    # Nope, that file doesn't even exist, so report that
+                    # fact back.
+                    print_e = e
+                sys.stderr.write("sconsign: %s\n" % (print_e))
+                return
+        except:
+            sys.stderr.write("sconsign: ignoring invalid `%s' file `%s'\n" % (self.dbm_name, fname))
+            return
+
+        if Print_Directories:
+            for dir in Print_Directories:
+                try:
+                    val = db[dir]
+                except KeyError:
+                    sys.stderr.write("sconsign: no dir `%s' in `%s'\n" % (dir, args[0]))
+                else:
+                    self.printentries(dir, val)
+        else:
+            keys = db.keys()
+            keys.sort()
+            for dir in keys:
+                self.printentries(dir, db[dir])
+
+    def printentries(self, dir, val):
+        print '=== ' + dir + ':'
+        printentries(cPickle.loads(val))
 
 def Do_SConsignDir(name):
     try:
@@ -238,9 +292,6 @@ def Do_SConsignDir(name):
         return
     printentries(sconsign.entries)
 
-Function_Map = {'dbm'      : Do_SConsignDB,
-                'sconsign' : Do_SConsignDir}
-
 ##############################################################################
 
 import getopt
@@ -275,12 +326,19 @@ for o, a in opts:
     elif o in ('-e', '--entry'):
         Print_Entries.append(a)
     elif o in ('-f', '--format'):
-        try:
-            Do_Func = Function_Map[a]
-        except KeyError:
-            sys.stderr.write("sconsign: illegal file format `%s'\n" % a)
-            print helpstr
-            sys.exit(2)
+        Module_Map = {'dblite'   : 'SCons.dblite',
+                      'sconsign' : None}
+        dbm_name = Module_Map.get(a, a)
+        if dbm_name:
+            try:
+                dbm = my_import(dbm_name)
+            except:
+                sys.stderr.write("sconsign: illegal file format `%s'\n" % a)
+                print helpstr
+                sys.exit(2)
+            Do_Call = Do_SConsignDB(a, dbm)
+        else:
+            Do_Call = Do_SConsignDir
     elif o in ('-h', '--help'):
         print helpstr
         sys.exit(0)
@@ -295,13 +353,18 @@ for o, a in opts:
 
 if Print_Flags == 0:
     Print_Flags = PF_all
-    
-for a in args:
-    if Do_Func:
-        Do_Func(a)
-    elif a[-4:] == '.dbm':
-        Do_SConsignDB(a)
-    else:
-        Do_SConsignDir(a)
+
+if Do_Call:
+    for a in args:
+        Do_Call(a)
+else:
+    for a in args:
+        dbm_name = whichdb.whichdb(a)
+        if dbm_name:
+            Map_Module = {'SCons.dblite' : 'dblite'}
+            dbm = my_import(dbm_name)
+            Do_SConsignDB(Map_Module.get(dbm_name, dbm_name), dbm)(a)
+        else:
+            Do_SConsignDir(a)
 
 sys.exit(0)
index c919c79b79a43ed5c0fdfb0ac9aeeac50adc749c..46d0954c9044cbb38753e6d2a47428a9415aefe0 100644 (file)
@@ -60,12 +60,7 @@ test.write(['work1', 'subdir', 'f4.in'], "work1/subdir/f4.in\n")
 
 test.run(chdir = 'work1')
 
-def any_dbm_file(prefix):
-    return os.path.exists(prefix) \
-           or os.path.exists(prefix + '.dat') \
-           or os.path.exists(prefix + '.dir')
-
-test.fail_test(not any_dbm_file(test.workpath('work1', '.sconsign.dbm')))
+test.must_exist(test.workpath('work1', '.sconsign.dblite'))
 test.must_not_exist(test.workpath('work1', '.sconsign'))
 test.must_not_exist(test.workpath('work1', 'subdir', '.sconsign'))
   
@@ -76,7 +71,7 @@ test.must_match(['work1', 'subdir', 'f4.out'], "work1/subdir/f4.in\n")
 
 test.up_to_date(chdir = 'work1', arguments = '.')
 
-test.fail_test(not any_dbm_file(test.workpath('work1', '.sconsign.dbm')))
+test.must_exist(test.workpath('work1', '.sconsign.dblite'))
 test.must_not_exist(test.workpath('work1', '.sconsign'))
 test.must_not_exist(test.workpath('work1', 'subdir', '.sconsign'))
 
@@ -99,8 +94,7 @@ test.write(['work2', 'subdir', 'f8.in'], "work2/subdir/f8.in\n")
 
 test.run(chdir = 'work2')
 
-test.fail_test(not any_dbm_file(test.workpath('work2', 'my_sconsign')))
-test.fail_test(any_dbm_file(test.workpath('work2', '.sconsign.dbm')))
+test.must_exist(test.workpath('work2', 'my_sconsign.dblite'))
 test.must_not_exist(test.workpath('work2', '.sconsign'))
 test.must_not_exist(test.workpath('work2', 'subdir', '.sconsign'))
 
@@ -111,8 +105,7 @@ test.must_match(['work2', 'subdir', 'f8.out'], "work2/subdir/f8.in\n")
 
 test.up_to_date(chdir = 'work2', arguments = '.')
 
-test.fail_test(not any_dbm_file(test.workpath('work2', 'my_sconsign')))
-test.fail_test(any_dbm_file(test.workpath('work2', '.sconsign.dbm')))
+test.must_exist(test.workpath('work2', 'my_sconsign.dblite'))
 test.must_not_exist(test.workpath('work2', '.sconsign'))
 test.must_not_exist(test.workpath('work2', 'subdir', '.sconsign'))
 
index 24e23a03d4135b4778bd1de8607ac413f1a79994..3098cd356db706d0157e5e41721b3f1aea3d196c 100644 (file)
@@ -267,7 +267,11 @@ test.run(chdir = 'work2', arguments = '--implicit-cache .')
 
 test.run(interpreter = TestSCons.python,
          program = sconsign,
-         arguments = "work2/.sconsign.dbm",
+         arguments = "work2/.sconsign")
+
+test.run(interpreter = TestSCons.python,
+         program = sconsign,
+         arguments = "work2/.sconsign",
          stdout = """\
 === sub1:
 hello.exe: None \S+ None
@@ -282,7 +286,7 @@ hello.obj: None \S+ None
 
 test.run(interpreter = TestSCons.python,
          program = sconsign,
-         arguments = "-v work2/.sconsign.dbm",
+         arguments = "-v work2/.sconsign",
          stdout = """\
 === sub1:
 hello.exe:
@@ -310,7 +314,7 @@ hello.obj:
 
 test.run(interpreter = TestSCons.python,
          program = sconsign,
-         arguments = "-b -v work2/.sconsign.dbm",
+         arguments = "-b -v work2/.sconsign",
          stdout = """\
 === sub1:
 hello.exe:
@@ -326,7 +330,7 @@ hello.obj:
 
 test.run(interpreter = TestSCons.python,
          program = sconsign,
-         arguments = "-c -v work2/.sconsign.dbm",
+         arguments = "-c -v work2/.sconsign",
          stdout = """\
 === sub1:
 hello.exe:
@@ -342,7 +346,7 @@ hello.obj:
 
 test.run(interpreter = TestSCons.python,
          program = sconsign,
-         arguments = "-e hello.obj work2/.sconsign.dbm",
+         arguments = "-e hello.obj work2/.sconsign",
          stdout = """\
 === sub1:
 hello.obj: None \S+ None
@@ -355,7 +359,7 @@ hello.obj: None \S+ None
 
 test.run(interpreter = TestSCons.python,
          program = sconsign,
-         arguments = "-e hello.obj -e hello.exe -e hello.obj work2/.sconsign.dbm",
+         arguments = "-e hello.obj -e hello.exe -e hello.obj work2/.sconsign",
          stdout = """\
 === sub1:
 hello.obj: None \S+ None
@@ -376,7 +380,7 @@ hello.obj: None \S+ None
 
 test.run(interpreter = TestSCons.python,
          program = sconsign,
-         arguments = "-i -v work2/.sconsign.dbm",
+         arguments = "-i -v work2/.sconsign",
          stdout = """\
 === sub1:
 hello.exe:
@@ -406,41 +410,93 @@ time.sleep(1)
 
 test.run(chdir = 'work2', arguments = '. --max-drift=1')
 
+expect = """\
+=== sub1:
+hello.exe: None \S+ None
+hello.obj: None \S+ None
+hello.c: \d+ None \d+
+"""
+
 test.run(interpreter = TestSCons.python,
          program = sconsign,
-         arguments = "-d sub1 -f dbm work2/my_sconsign")
+         arguments = "-d sub1 -f dblite work2/my_sconsign")
 
-test.fail_test(not sort_match(test, test.stdout(), """\
+test.fail_test(not sort_match(test, test.stdout(), expect))
+
+test.run(interpreter = TestSCons.python,
+         program = sconsign,
+         arguments = "-d sub1 -f dblite work2/my_sconsign.dblite")
+
+test.fail_test(not sort_match(test, test.stdout(), expect))
+
+expect = """\
 === sub1:
 hello.exe: None \S+ None
 hello.obj: None \S+ None
 hello.c: \d+ None \d+
-"""))
+"""
 
 test.run(interpreter = TestSCons.python,
          program = sconsign,
-         arguments = "-r -d sub1 -f dbm work2/my_sconsign")
+         arguments = "-d sub1 -f dblite work2/my_sconsign")
 
-test.fail_test(not sort_match(test, test.stdout(), """\
+test.fail_test(not sort_match(test, test.stdout(), expect))
+
+test.run(interpreter = TestSCons.python,
+         program = sconsign,
+         arguments = "-d sub1 -f dblite work2/my_sconsign.dblite")
+
+test.fail_test(not sort_match(test, test.stdout(), expect))
+
+expect = """\
 === sub1:
 hello.exe: None \S+ None
 hello.obj: None \S+ None
 hello.c: '\S+ \S+ [ \d]\d \d\d:\d\d:\d\d \d\d\d\d' None \d+
-"""))
+"""
+
+test.run(interpreter = TestSCons.python,
+         program = sconsign,
+         arguments = "-r -d sub1 -f dblite work2/my_sconsign")
+
+test.fail_test(not sort_match(test, test.stdout(), expect))
+
+test.run(interpreter = TestSCons.python,
+         program = sconsign,
+         arguments = "-r -d sub1 -f dblite work2/my_sconsign.dblite")
+
+test.fail_test(not sort_match(test, test.stdout(), expect))
 
 ##############################################################################
 
-test.write('bad_sconsign', "bad_sconsign\n")
+test.write('bad1', "bad1\n")
+test.write('bad2.dblite', "bad2.dblite\n")
+test.write('bad3', "bad3\n")
 
 test.run(interpreter = TestSCons.python,
          program = sconsign,
-         arguments = "-f dbm no_sconsign",
+         arguments = "-f dblite no_sconsign",
          stderr = "sconsign: \[Errno 2\] No such file or directory: 'no_sconsign'\n")
 
 test.run(interpreter = TestSCons.python,
          program = sconsign,
-         arguments = "-f dbm bad_sconsign",
-         stderr = "sconsign: ignoring invalid .sconsign.dbm file `bad_sconsign': db type could not be determined\n")
+         arguments = "-f dblite bad1",
+         stderr = "sconsign: \[Errno 2\] No such file or directory: 'bad1.dblite'\n")
+
+test.run(interpreter = TestSCons.python,
+         program = sconsign,
+         arguments = "-f dblite bad1.dblite",
+         stderr = "sconsign: \[Errno 2\] No such file or directory: 'bad1.dblite'\n")
+
+test.run(interpreter = TestSCons.python,
+         program = sconsign,
+         arguments = "-f dblite bad2",
+         stderr = "sconsign: ignoring invalid `dblite' file `bad2'\n")
+
+test.run(interpreter = TestSCons.python,
+         program = sconsign,
+         arguments = "-f dblite bad2.dblite",
+         stderr = "sconsign: ignoring invalid `dblite' file `bad2.dblite'\n")
 
 test.run(interpreter = TestSCons.python,
          program = sconsign,
@@ -449,8 +505,7 @@ test.run(interpreter = TestSCons.python,
 
 test.run(interpreter = TestSCons.python,
          program = sconsign,
-         arguments = "-f sconsign bad_sconsign",
-         stderr = "sconsign: ignoring invalid .sconsign file `bad_sconsign'\n")
-
+         arguments = "-f sconsign bad3",
+         stderr = "sconsign: ignoring invalid .sconsign file `bad3'\n")
 
 test.pass_test()