[Scons-users] Identical file names in VariantDir and source dir

Dmitry Mikhin dmitry.mikhin at gmail.com
Wed Nov 14 22:27:09 EST 2012


Hello everyone,

Got badly bitten today.

Context: a test suite is driven by SCons. The original, reference
result for one of the problems is stored in the source directory under
the name "sml_bd_1.txt". The same file is re-generated in the
VariantDir build directory. The two are compared to verify that the
project is still working.

Today noticed a problem ("run_rms_scons" below is a custom builder for
comparing files):

run_rms_scons(["build/tests/Benchmarks/ASA/small_bd.passed"],
["build/tests/Benchmarks/ASA/sml_bd_1.txt",
"build/tests/Benchmarks/ASA/sml_bd_1.txt", "build/util/rms"])
"build/util/rms" build/tests/Benchmarks/ASA/sml_bd_1.txt
build/tests/Benchmarks/ASA/sml_bd_1.txt

I.e., the builder compares the built file to itself. Obviously, it
always works fine and passes the comparison. The original reference
file is different. Many cases all over the test base, some over a year
old, may be more, and still digging.

Although the problem is obvious, it's pretty hard to notice in a mess
of scons run output, and the whole idea of hiding in plain sight
worked great, once again.

Now, questions:

1. Is it possible to enforce that some files are from the source
directory, never from the Variant build directory?

2. Can SCons warn about this behavior? IMO, the presence of two files
with identical names suggests that the same node can be "created" by
two methods, and generally SCons would catch it.

3. Also, I have a feeling that the "least astonishment" idea somehow
got lost in this case. At least on me.

My scons version is:

$ scons --version
SCons by Steven Knight et al.:
script: v2.1.0.r5357[MODIFIED], 2011/09/09 21:31:03, by bdeegan on ubuntu
engine: v2.1.0.r5357[MODIFIED], 2011/09/09 21:31:03, by bdeegan on ubuntu
engine path: ['/usr/lib/scons/SCons']
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
2010, 2011 The SCons Foundation

Cheers,
Dmitry


More information about the Scons-users mailing list