summaryrefslogtreecommitdiff
path: root/SConscript.smoke
blob: 0710dcbb8d47de3289c1ce2917f4c59ac1b20d19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# -*- mode: python -*-
#
# This SConscript file describes the build rules for smoke tests (scons smoke,
# e.g.)

import os
from buildscripts import utils

Import( "has_option env" )

def add_exe( v ):
    return "${PROGPREFIX}%s${PROGSUFFIX}" % v

smokeEnv = env.Clone()
smokeEnv['ENV']['PATH']=os.environ['PATH']

# copy in any envrionment variables beginning with MONGO_; these
# are used by buildscripts/buildlogger.py
for name, value in os.environ.items():
    if name.startswith('MONGO_'):
        smokeEnv['ENV'][name] = value

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"]

if has_option('smokeauth'):
    smokeFlags += ['--auth']

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, extraSmokeArgs=[] ):
    # Convert from smoke to test, smokeJs to js, and foo to foo
    target = name
    if name.startswith("smoke"):
        if name == "smoke":
            target = File("dbtest").path
        else:
            target = name[5].lower() + name[6:]

    smokeArgs = smokeFlags + [target] + extraSmokeArgs
    addTest(name, deps, utils.run_smoke_command(*smokeArgs))

def addSmokeSuite( name, suitefile, needMongod=False ):
    # Add a smoketest target which invokes smoke.py with
    # --from-file, and passes the named suitefile as the
    # command line argument.

    # resolve an initial # in the suitefile
    suitefile = str(env.File(suitefile))

    smoke_args = ['--mode', 'files', '--from-file', suitefile]
    if not needMongod:
        smoke_args.append('--dont-start-mongod')
    addTest(name, [suitefile], utils.run_smoke_command(*smoke_args))

addSmoketest( "smoke", [ add_exe( "dbtest" ), add_exe( "mongod" ), add_exe( "mongo" ) ] )
addSmoketest( "smokePerf", [ add_exe("perftest") ]  )

addSmoketest( "mongosTest", [ add_exe( 'mongos' ) ])
addSmokeSuite( "smokeCppUnittests", "$UNITTEST_LIST" )

# These tests require the mongo shell
if not has_option('noshell'):
    addSmoketest( "smokeJs", [add_exe("mongo"), add_exe("mongod")] )
    addSmoketest( "smokeJsCore", [add_exe("mongo"), add_exe("mongod")] )
    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"), add_exe('mongofiles') ] )
    addSmoketest( "smokeJsPerf", [ add_exe("mongo"), add_exe("mongod") ] )
    addSmoketest( "smokeNoPassthroughWithMongod", [add_exe("mongo"), add_exe("mongod"), add_exe("mongos") ])
    addSmoketest( "smokeNoPassthrough", [add_exe("mongo"), add_exe("mongod"), add_exe("mongos") ])
    addSmoketest( "smokeSlow1", [add_exe("mongo"), add_exe("mongod"), add_exe("mongos") ])
    addSmoketest( "smokeSlow2", [add_exe("mongo"), add_exe("mongod"), add_exe("mongos") ])
    addSmoketest( "smokeQuota", [ add_exe("mongo"), add_exe("mongod") ] )
    addSmoketest( "smokeTool", [ add_exe( "mongo" ), add_exe("mongod"), add_exe("mongos"), "tools" ] )
    addSmoketest( "smokeAggregation", [ add_exe( "mongo" ), add_exe( "mongod" ), add_exe( "mongos" ) ] )
    addSmoketest( "smokeMultiVersion", [ add_exe( "mongo" ), add_exe( "mongod" ), add_exe( "mongos" ) ] )
    addSmoketest( "smokeFailPoint", [ add_exe( "mongo" ), add_exe( "mongod" ), add_exe( "mongos" ) ] )
    addSmoketest( "smokeSsl", [ add_exe("mongo"), add_exe("mongod"), add_exe("mongos"), "tools" ],
                  ['--use-ssl','--use-x509'] )
    
    addSmoketest( "smokeFailingTests", [ add_exe( "mongo" ), add_exe( "mongod" ) ], ['--only-old-fails', '--continue-on-failure'] )
    addSmoketest( "smokeResetFails", [ add_exe( "mongo" ), add_exe( "mongod" ) ], ['--reset-old-fails'] )

smokeEnv.Alias( "startMongodSmallOplog", [add_exe("mongod")], [] );
smokeEnv.AlwaysBuild( "startMongodSmallOplog" );
smokeEnv.SideEffect( "dummySmokeSideEffect", "startMongodSmallOplog" )

def addMongodReqTargets( env, target, source ):
    mongodReqTargets = [ "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 = []
    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")