Permalink
Browse files

SCons updates to support variant directories.

This patch is a reorganization of our build files, which brings them slightly
closer in line with standard SCons organization.

In particular, the SConstruct file sets up the various "build environment"
objects, by examining the local system and command line parameters.  Then, it
delegates to some SConscript files, which describe build rules, like how to
compile "mongod" from source.

Typically, you would create several SConscript files for a project this large,
after breaking the project into logical sub projects, such as "platform
abstraction", "data manager", "query optimizer", etc.  That will be future work.
For now, we only separate out the special rules for executing smoke tests into
SConscript.smoke.  Pretty much all other build rules are in src/mongo/SConscript.

"tools" are placed in site_scons/site_tools.

This patch also includes better support for building and tracking dependencies
among static libraries ("libdeps" and "MergeLibrary"), and some incumbent, minor
restructuring.

This patch introduces a "warning" message from SCons about framework.o having
two rules that generate it.  It is harmless, for now, and will be removed in
future work.

Future work also includes eliminating use of the SCons "Glob" utility, and
restructuring the source code into sensible components.
  • Loading branch information...
1 parent 8a002c3 commit 30668e1c79cf6e8dac45a61b64694c045e1a59f5 @amschwerin amschwerin committed Jan 4, 2012
View
@@ -1,9 +1,10 @@
-.jsdbshell
-.dbshell
-.sconsign.dblite
-.sconf_temp
-perf.data
-massif.out.*
+/build
+/.jsdbshell
+/.dbshell
+/.sconsign.dblite
+/.sconf_temp
+/perf.data
+/massif.out.*
*~
*.swp
@@ -17,7 +18,6 @@ massif.out.*
*.ncb
*.idb
*.obj
-*/*.obj
*.opt
*.pch
*.jsh
@@ -36,8 +36,6 @@ massif.out.*
*.psess
*#
.#*
-/src/mongo/shell/mongo.cpp
-/src/mongo/shell/mongo-server.cpp
/src/mongo/*/*Debug/
/src/mongo/*/*/*Debug/
@@ -50,7 +48,6 @@ massif.out.*
/src/mongo/db/_ReSharper.db
config.log
settings.py
-buildinfo.cpp
tags
TAGS
failfile.smoke
@@ -67,50 +64,47 @@ scratch
# binaries
/mongo
-mongod
-mongogrid
-mongos
+/mongod
+/mongogrid
+/mongos
-mongodump
-mongorestore
+/mongodump
+/mongorestore
-mongofiles
-mongoexport
+/mongofiles
+/mongoexport
-mongoimport
-mongosniff
-mongobridge
-mongostat
-mongotop
-mongooplog
-mongoperf
-bsondump
+/mongoimport
+/mongosniff
+/mongobridge
+/mongostat
+/mongotop
+/mongooplog
+/mongoperf
+/bsondump
*.tgz
*.zip
*.tar.gz
-mongodb-*
-mongo-cxx-driver-*
-
#libs
-libmongoclient.*
-libmongotestfiles.*
-libmongoshellfiles.*
+/libmongoclient.*
+/libmongotestfiles.*
+/libmongoshellfiles.*
# examples
-firstExample
-secondExample
-whereExample
-bsondemo
-rsExample
+/firstExample
+/secondExample
+/whereExample
+/bsondemo
+/rsExample
#tests
-test
-authTest
-perftest
-clientTest
-httpClientTest
+/test
+/authTest
+/perftest
+/clientTest
+/httpClientTest
#debian
build-stamp
@@ -122,12 +116,6 @@ debian/mongodb
#osx
.DS_Store
-#third party
-src/third_party/js-1.7/jsautocfg.h
-src/third_party/js-1.7/jsautokw.h
-src/third_party/js-1.7/jskwgen
-src/third_party/js-1.7/jscpucfg
-
# QtCreator
*.config
*.creator
View
@@ -0,0 +1,117 @@
+# -*- mode: python -*-
+#
+# This SConscript file describes the build rules for smoke tests (scons smoke,
+# e.g.)
+
+import os
+
+Import( "has_option env shellEnv testEnv" )
+
+def add_exe( v ):
+ return "${PROGPREFIX}%s${PROGSUFFIX}" % v
+
+smokeEnv = testEnv.Clone()
+smokeEnv['ENV']['PATH']=os.environ['PATH']
+smokeEnv.Alias( "dummySmokeSideEffect", [], [] )
+
+smokeFlags = []
+
+# Ugh. Frobbing the smokeFlags must precede using them to construct
+# actions, I think.
+if has_option( 'smokedbprefix'):
+ smokeFlags += ['--smoke-db-prefix', GetOption( 'smokedbprefix')]
+
+if 'startMongodSmallOplog' in COMMAND_LINE_TARGETS:
+ smokeFlags += ["--small-oplog"]
+
+def addTest(name, deps, actions):
+ smokeEnv.Alias( name, deps, actions )
+ smokeEnv.AlwaysBuild( name )
+ # Prevent smoke tests from running in parallel
+ smokeEnv.SideEffect( "dummySmokeSideEffect", name )
+
+def addSmoketest( name, deps ):
+ # Convert from smoke to test, smokeJs to js, and foo to foo
+ target = name
+ if name.startswith("smoke"):
+ if name == "smoke":
+ target = File("test").path
+ else:
+ target = name[5].lower() + name[6:]
+
+ addTest(name, deps, [ "python buildscripts/smoke.py " + " ".join(smokeFlags) + ' ' + target ])
+
+addSmoketest( "smoke", [ add_exe( "test" ), add_exe( "mongod" ), add_exe( "mongo" ) ] )
+addSmoketest( "smokePerf", [ add_exe("perftest") ] )
+addSmoketest( "smokeClient", [
+ add_exe('firstExample'),
+ add_exe('rsExample'),
+ add_exe('secondExample'),
+ add_exe('whereExample'),
+ add_exe('authTest'),
+ add_exe('httpClientTest'),
+ add_exe('bsondemo'),
+ add_exe('clientTest'),
+ ] )
+addSmoketest( "mongosTest", [ add_exe( 'mongos' ) ])
+
+# These tests require the mongo shell
+if shellEnv is not None:
+ addSmoketest( "smokeJs", [add_exe("mongo")] )
+ addSmoketest( "smokeClone", [ add_exe("mongo"), add_exe("mongod") ] )
+ addSmoketest( "smokeRepl", [ add_exe("mongo"), add_exe("mongod"), add_exe("mongobridge") ] )
+ addSmoketest( "smokeReplSets", [ add_exe("mongo"), add_exe("mongod"), add_exe("mongobridge") ] )
+ addSmoketest( "smokeDur", [ add_exe( "mongo" ), add_exe( "mongod" ), add_exe('mongorestore') ] )
+ addSmoketest( "smokeDisk", [ add_exe( "mongo" ), add_exe( "mongod" ), add_exe( "mongodump" ), add_exe( "mongorestore" ) ] )
+ addSmoketest( "smokeAuth", [ add_exe( "mongo" ), add_exe( "mongod" ) ] )
+ addSmoketest( "smokeParallel", [ add_exe( "mongo" ), add_exe( "mongod" ) ] )
+ addSmoketest( "smokeSharding", [ add_exe("mongo"), add_exe("mongod"), add_exe("mongos") ] )
+ addSmoketest( "smokeJsPerf", [ add_exe("mongo") ] )
+ addSmoketest( "smokeJsSlowNightly", [add_exe("mongo")])
+ addSmoketest( "smokeJsSlowWeekly", [add_exe("mongo")])
+ addSmoketest( "smokeQuota", [ add_exe("mongo") ] )
+ addSmoketest( "smokeTool", [ add_exe( "mongo" ), add_exe("mongod"), add_exe("mongos"), "tools" ] )
+
+# Note: although the test running logic has been moved to
+# buildscripts/smoke.py, the interface to running the tests has been
+# something like 'scons startMongod <suite>'; startMongod is now a
+# no-op, and should go away eventually.
+smokeEnv.Alias( "startMongod", [add_exe("mongod")]);
+smokeEnv.AlwaysBuild( "startMongod" );
+smokeEnv.SideEffect( "dummySmokeSideEffect", "startMongod" )
+
+smokeEnv.Alias( "startMongodSmallOplog", [add_exe("mongod")], [] );
+smokeEnv.AlwaysBuild( "startMongodSmallOplog" );
+smokeEnv.SideEffect( "dummySmokeSideEffect", "startMongodSmallOplog" )
+
+def addMongodReqTargets( env, target, source ):
+ mongodReqTargets = [ "smokeClient", "smokeJs" ]
+ for target in mongodReqTargets:
+ smokeEnv.Depends( target, "startMongod" )
+ smokeEnv.Depends( "smokeAll", target )
+
+smokeEnv.Alias( "addMongodReqTargets", [], [addMongodReqTargets] )
+smokeEnv.AlwaysBuild( "addMongodReqTargets" )
+
+smokeEnv.Alias( "smokeAll", [ "smoke", "mongosTest", "smokeClone", "smokeRepl", "addMongodReqTargets", "smokeDisk", "smokeAuth", "smokeSharding", "smokeTool" ] )
+smokeEnv.AlwaysBuild( "smokeAll" )
+
+def addMongodReqNoJsTargets( env, target, source ):
+ mongodReqTargets = [ "smokeClient" ]
+ for target in mongodReqTargets:
+ smokeEnv.Depends( target, "startMongod" )
+ smokeEnv.Depends( "smokeAllNoJs", target )
+
+smokeEnv.Alias( "addMongodReqNoJsTargets", [], [addMongodReqNoJsTargets] )
+smokeEnv.AlwaysBuild( "addMongodReqNoJsTargets" )
+
+smokeEnv.Alias( "smokeAllNoJs", [ "smoke", "mongosTest", "addMongodReqNoJsTargets" ] )
+smokeEnv.AlwaysBuild( "smokeAllNoJs" )
+
+def run_shell_tests(env, target, source):
+ from buildscripts import test_shell
+ test_shell.mongo_path = windows and "mongo.exe" or "mongo"
+ test_shell.run_tests()
+
+env.Alias("test_shell", [], [run_shell_tests])
+env.AlwaysBuild("test_shell")
Oops, something went wrong.

0 comments on commit 30668e1

Please sign in to comment.