#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#

# -*- mode: python; -*-
import platform

Import('BuildEnv')
env = BuildEnv.Clone()

env.Append(LIBPATH = env['TOP'] + '/db')
env.Append(LIBPATH = env['TOP'] + '/db/test')
env.Append(LIBPATH = env['TOP'] + '/base')
env.Append(LIBPATH = env['TOP'] + '/base/test')
env.Append(LIBPATH = env['TOP'] + '/io')

libdbtest = env.Library('dbtest', ['db_test_util.cc'])
env.Alias('src/db:libdbtest', libdbtest)

env.Prepend(LIBS = ['db', 'dbtest', 'gunit', 'task_test', 'io', 'sandesh',
                    'sandeshvns', 'process_info', 'base',
                    'http', 'http_parser', 'curl', 'io', 'ssl', 'crypto',
                    'pugixml', 'boost_program_options'])

if platform.system() != 'Darwin':
    env.Append(LIBS=['rt'])

db_test = env.UnitTest('db_test', ['db_test.cc'])
env.Alias('src/db:db_test', db_test)

db_base_test = env.UnitTest('db_base_test', ['db_base_test.cc'])
env.Alias('src/db:db_base_test', db_base_test)

db_find_test = env.UnitTest('db_find_test', ['db_find_test.cc'])
env.Alias('src/db:db_find_test', db_find_test)

db_graph_test = env.UnitTest('db_graph_test', ['db_graph_test.cc'])
env.Alias('src/db:db_graph_test', db_graph_test)

test_suite = [
    db_graph_test
]

flaky_test_suite = [
    db_test,
    db_base_test,
    db_find_test,
]

test = env.TestSuite('all-test', test_suite)
env.Alias('controller/src/db:test', test)

flaky_test = env.TestSuite('db-flaky-test', flaky_test_suite)
env.Alias('controller/src/db:flaky-test', flaky_test)

Return('test_suite')

