1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-28 14:50:08 +03:00

Feature #457: Refactor of tests build process

This commit is contained in:
Carlos Martín 2011-01-26 16:05:43 +00:00 committed by Ruben S. Montero
parent 2fa213ceac
commit 43b4340177
31 changed files with 226 additions and 895 deletions

View File

@ -107,6 +107,9 @@ if mysql=='yes':
else:
main_env.Append(mysql='no')
# Testing
testing=ARGUMENTS.get('testing', 'no')
# xmlrpc
xmlrpc_dir=ARGUMENTS.get('xmlrpc', 'none')
@ -184,6 +187,37 @@ build_scripts=[
'src/authm/SConstruct',
]
if testing=='yes':
main_env.Append(CPPPATH=[
cwd+'/include/test',
'/usr/include/cppunit/'
])
main_env.Append(LIBPATH=[
cwd+'/src/test',
])
main_env.Append(LIBS=[
'nebula_test_common',
])
build_scripts.extend([
'src/authm/test/SConstruct',
'src/common/test/SConstruct',
'src/host/test/SConstruct',
'src/image/test/SConstruct',
'src/lcm/test/SConstruct',
'src/pool/test/SConstruct',
'src/scheduler/src/pool/test/SConstruct',
'src/scheduler/src/xml/test/SConstruct',
'src/template/test/SConstruct',
'src/test/SConstruct',
'src/um/test/SConstruct',
'src/vm/test/SConstruct',
'src/vnm/test/SConstruct',
])
for script in build_scripts:
env=main_env.Clone()
SConscript(script, exports='env')

View File

@ -209,10 +209,6 @@ public:
/* -----------------------------------------------------------------------------
bool OneUnitTest::mysql;
SqlDB * OneUnitTest::db = 0;
string OneUnitTest::db_name = "ONE_test_database";
int main(int argc, char ** argv)
{
return OneUnitTest::main(argc, argv, TestClass::suite());

View File

@ -223,10 +223,6 @@ public:
};
};
bool OneUnitTest::mysql;
SqlDB * OneUnitTest::db = 0;
string OneUnitTest::db_name = "ONE_test_database";
// -----------------------------------------------------------------------------
#endif // POOL_TEST_H_

View File

@ -80,6 +80,21 @@ elif [ "$VAL_CALL" = "yes" ] ; then
CALLER="valgrind --tool=callgrind"
fi
if [ "$BUILD" = "yes" ] ; then
cd ../..
scons testing=yes $BUILD_ARGS
cd $BASE_DIR
exit 0
fi
if [ "$CLEAR" = "yes" ] ; then
cd ../..
scons testing=yes -c
cd $BASE_DIR
fi
TESTS=`find $TWD_DIR -name test -type d`
for i in $TESTS ; do
@ -99,10 +114,7 @@ for i in $TESTS ; do
cd $i
if [ "$CLEAR" = "yes" ] ; then
scons -c
rm -f callgrind.out* test.db* *.log* memgrid.out*
elif [ "$BUILD" = "yes" ] ; then
scons $BUILD_ARGS
rm -f callgrind.out* test.db* *.log* memgrid.out* *.xml
else
for j in `ls test*` ; do
if [ -x $j ] ; then

View File

@ -278,11 +278,6 @@ private:
/* ************************************************************************* */
/* ************************************************************************* */
bool OneUnitTest::mysql;
SqlDB * OneUnitTest::db = 0;
string OneUnitTest::db_name = "ONE_test_database";
int main(int argc, char ** argv)
{
return OneUnitTest::main(argc, argv, AuthManagerTest::suite());

View File

@ -15,41 +15,9 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
import os
import sys
import shutil
sys.path.append("../../../share/scons")
from lex_bison import *
Import('env')
# This is the absolute path where the project is located
cwd="../../../"
# Environment that will be applied to each scons child
main_env=Environment()
main_env['ENV']['PATH']=os.environ['PATH']
# Add builders for flex and bison
add_lex(main_env)
add_bison(main_env)
# Include dirs
main_env.Append(CPPPATH=[
cwd + '/include',
'/usr/include/cppunit/'
])
# Library dirs
main_env.Append(LIBPATH=[
cwd + '/src/common',
cwd + '/src/template',
cwd + '/src/mad',
cwd + '/src/nebula',
cwd + '/src/authm',
cwd + '/src/sql',
cwd + '/src/log',
])
main_env.Append(LIBS=[
env.Append(LIBS=[
'nebula_template',
'nebula_common',
'nebula_core',
@ -63,30 +31,16 @@ main_env.Append(LIBS=[
'ssl'
])
# Compile flags
main_env.Append(CPPFLAGS=[
"-g",
"-Wall",
"-Werror"
])
# MYSQL
main_env.Append(LIBPATH=["/usr/lib/mysql"])
main_env.Append(CPPPATH=["/usr/include/mysql"])
# libxml2
main_env.ParseConfig('xml2-config --libs --cflags')
sqlite=ARGUMENTS.get('sqlite', 'yes')
if sqlite=='yes':
main_env.Append(CPPFLAGS=["-DSQLITE_DB"])
main_env.Append(LIBS=[ 'sqlite3', ])
env.Append(CPPFLAGS=["-DSQLITE_DB"])
env.Append(LIBS=[ 'sqlite3', ])
# MySQL
mysql=ARGUMENTS.get('mysql', 'no')
if mysql=='yes':
main_env.Append(CPPFLAGS=["-DMYSQL_DB"])
main_env.Append(LIBS=[ 'mysqlclient', ])
env.Append(CPPFLAGS=["-DMYSQL_DB"])
env.Append(LIBS=[ 'mysqlclient', ])
main_env.Program('test','AuthManagerTest.cc')
env.Program('test','AuthManagerTest.cc')
#

View File

@ -15,36 +15,9 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
import os
import sys
import shutil
sys.path.append("../../../share/scons")
from lex_bison import *
Import('env')
# This is the absolute path where the project is located
cwd="../../../"
# Environment that will be applied to each scons child
main_env=Environment()
main_env['ENV']['PATH']=os.environ['PATH']
# Add builders for flex and bison
add_lex(main_env)
add_bison(main_env)
# Include dirs
main_env.Append(CPPPATH=[
cwd + '/include',
'/usr/include/cppunit/'
])
# Library dirs
main_env.Append(LIBPATH=[
cwd + '/src/common',
cwd + '/src/log',
])
main_env.Append(LIBS=[
env.Append(LIBS=[
'nebula_common',
'nebula_log',
'cppunit',
@ -52,17 +25,7 @@ main_env.Append(LIBS=[
'pthread'
])
# Compile flags
main_env.Append(CPPFLAGS=[
"-g",
"-Wall",
"-Werror"
])
# Linking flags
main_env.Append(LDFLAGS=["-g"])
main_env.Program('test_sa','single_attribute.cc')
main_env.Program('test_va','vector_attribute.cc')
main_env.Program('test_am','action_manager.cc')
main_env.Program('test_collector','mem_collector.cc')
env.Program('test_sa','single_attribute.cc')
env.Program('test_va','vector_attribute.cc')
env.Program('test_am','action_manager.cc')
env.Program('test_collector','mem_collector.cc')

View File

@ -175,11 +175,6 @@ public:
}
};
bool OneUnitTest::mysql;
SqlDB * OneUnitTest::db = 0;
string OneUnitTest::db_name = "ONE_test_database";
int main(int argc, char ** argv)
{
return OneUnitTest::main(argc, argv, ActionManagerTest::suite(),

View File

@ -95,10 +95,6 @@ public:
}
};
bool OneUnitTest::mysql;
SqlDB * OneUnitTest::db = 0;
string OneUnitTest::db_name = "ONE_test_database";
int main(int argc, char ** argv)
{
return OneUnitTest::main(argc, argv, MemCollectorTest::suite(),

View File

@ -113,10 +113,6 @@ public:
}
};
bool OneUnitTest::mysql;
SqlDB * OneUnitTest::db = 0;
string OneUnitTest::db_name = "ONE_test_database";
int main(int argc, char ** argv)
{
return OneUnitTest::main(argc, argv, SingleAttributeTest::suite(),

View File

@ -143,13 +143,8 @@ public:
}
};
bool OneUnitTest::mysql;
SqlDB * OneUnitTest::db = 0;
string OneUnitTest::db_name = "ONE_test_database";
int main(int argc, char ** argv)
{
return OneUnitTest::main(argc, argv, VectorAttributeTest::suite(),
"vector_attribute");
"vector_attribute.xml");
}

View File

@ -1,3 +1,5 @@
# SConstruct for src/host/test
# -------------------------------------------------------------------------- #
# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) #
# #
@ -14,193 +16,9 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
import os
import sys
import shutil
sys.path.append("../../../share/scons")
from lex_bison import *
Import('env')
# This is the absolute path where the project is located
cwd="../../.."
# Environment that will be applied to each scons child
main_env=Environment()
main_env['ENV']['PATH']=os.environ['PATH']
# snippet borrowed from http://dev.gentoo.org/~vapier/scons-blows.txt
# makes scons aware of build related environment variables
if os.environ.has_key('CC'):
main_env['CC'] = os.environ['CC']
if os.environ.has_key('CFLAGS'):
main_env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS'])
if os.environ.has_key('CXX'):
main_env['CXX'] = os.environ['CXX']
if os.environ.has_key('CXXFLAGS'):
main_env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS'])
if os.environ.has_key('LDFLAGS'):
main_env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS'])
# Add builders for flex and bison
add_lex(main_env)
add_bison(main_env)
# Include dirs
main_env.Append(CPPPATH=[
'.',
cwd+'/include',
cwd+'/include/test',
cwd+'/src/hm/test',
'/usr/include/cppunit/'
])
# Library dirs
main_env.Append(LIBPATH=[
cwd+'/src/common',
cwd+'/src/log',
cwd+'/src/sql',
cwd+'/src/host',
cwd+'/src/mad',
cwd+'/src/nebula',
cwd+'/src/pool',
cwd+'/src/template',
cwd+'/src/vm',
cwd+'/src/vmm',
cwd+'/src/lcm',
cwd+'/src/tm',
cwd+'/src/dm',
cwd+'/src/im',
cwd+'/src/image',
cwd+'/src/rm',
cwd+'/src/vnm',
cwd+'/src/hm',
cwd+'/src/um',
cwd+'/src/authm',
'.',
])
# Compile flags
main_env.Append(CPPFLAGS=[
"-g",
"-Wall",
"-Werror",
])
# Linking flags
main_env.Append(LINKFLAGS=['-g', '-pthread'])
#######################
# EXTRA CONFIGURATION #
#######################
# SQLITE
sqlite_dir=ARGUMENTS.get('sqlite_dir', 'none')
if sqlite_dir!='none':
main_env.Append(LIBPATH=[sqlite_dir+"/lib"])
main_env.Append(CPPPATH=[sqlite_dir+"/include"])
sqlite=ARGUMENTS.get('sqlite', 'yes')
if sqlite=='yes':
main_env.Append(sqlite='yes')
main_env.Append(CPPFLAGS=["-DSQLITE_DB"])
else:
main_env.Append(sqlite='no')
# MySQL
mysql=ARGUMENTS.get('mysql', 'no')
if mysql=='yes':
main_env.Append(mysql='yes')
main_env.Append(CPPFLAGS=["-DMYSQL_DB"])
else:
main_env.Append(mysql='no')
# xmlrpc
xmlrpc_dir=ARGUMENTS.get('xmlrpc', 'none')
if xmlrpc_dir!='none':
main_env.Append(LIBPATH=[xmlrpc_dir+"/lib"])
main_env.Append(CPPPATH=[xmlrpc_dir+"/include"])
# build lex/bison
build_parsers=ARGUMENTS.get('parsers', 'no')
if build_parsers=='yes':
main_env.Append(parsers='yes')
else:
main_env.Append(parsers='no')
if not main_env.GetOption('clean'):
try:
main_env.ParseConfig('../../../share/scons/get_xmlrpc_config server')
main_env.ParseConfig('../../../share/scons/get_xmlrpc_config client')
if mysql=='yes':
main_env.ParseConfig('mysql_config --cflags --libs')
except Exception, e:
print ""
print "Error searching for xmlrpc-c libraries. Please check this"+\
" things:"
print ""
print " * You have installed development libraries for xmlrpc-c. One"+\
" way to check"
print " this is calling xmlrpc-c-config that is provided with the"+\
" development"
print " package."
print " * Check that the version of xmlrpc-c is at least 1.06. You"+\
" can do this also"
print " calling:"
print " $ xmlrpc-c-config --version"
print " * If all this requirements are already met please send log"+\
" files located in"
print " .xmlrpc_test to the mailing list."
print ""
exit(-1)
else:
main_env.Replace(mysql='yes')
shutil.rmtree('.xmlrpc_test', True)
shutil.rmtree('src/nebula/.xmlrpc_test', True)
shutil.rmtree('src/scheduler/.xmlrpc_test', True)
# libxml2
main_env.ParseConfig('xml2-config --libs --cflags')
# Build LCM and DM toguether in a lib
lib_name='nebula_lcm_dm'
# Sources to generate the library
source_files=[
'../../lcm/LifeCycleManager.cc',
'../../lcm/LifeCycleActions.cc',
'../../lcm/LifeCycleStates.cc',
'../../dm/DispatchManager.cc',
'../../dm/DispatchManagerActions.cc',
'../../dm/DispatchManagerStates.cc',
]
# Build library
main_env.StaticLibrary(lib_name, source_files)
# Build a modified Nebula lib
lib_name='nebula_core_test'
# Sources to generate the library
source_files=[
'../../nebula/test/Nebula.cc',
'../../nebula/test/NebulaTest.cc',
'../../nebula/NebulaTemplate.cc',
'../../../include/test/OneUnitTest.cc',
]
# Build library
main_env.StaticLibrary(lib_name, source_files)
# Build daemon
main_env.Append(LIBS=[
env.Append(LIBS=[
'nebula_core_test',
'nebula_host',
@ -228,16 +46,11 @@ main_env.Append(LIBS=[
])
# Sources to generate the library
if main_env['sqlite']=='yes':
main_env.Append(LIBS=['sqlite3'])
if env['sqlite']=='yes':
env.Append(LIBS=['sqlite3'])
if main_env['mysql']=='yes':
main_env.Append(LIBS=['mysqlclient'])
if env['mysql']=='yes':
env.Append(LIBS=['mysqlclient'])
if not main_env.GetOption('clean'):
main_env.ParseConfig('../../../share/scons/get_xmlrpc_config server')
main_env.Program('test','HostPoolTest.cc')
main_env.Program('test_hook','HostHookTest.cc')
env.Program('test','HostPoolTest.cc')
env.Program('test_hook','HostHookTest.cc')

View File

@ -14,49 +14,9 @@
# limitations under the License.
# --------------------------------------------------------------------------
import os
import sys
import shutil
sys.path.append("../../../share/scons")
from lex_bison import *
Import('env')
# This is the absolute path where the project is located
cwd="../../../"
# Environment that will be applied to each scons child
main_env=Environment()
main_env['ENV']['PATH']=os.environ['PATH']
# Add builders for flex and bison
add_lex(main_env)
add_bison(main_env)
# Include dirs
main_env.Append(CPPPATH=[
cwd + '/include',
cwd + '/include/test',
'/usr/include/cppunit/',
])
# Library dirs
main_env.Append(LIBPATH=[
cwd + '/src/common',
cwd + '/src/log',
cwd + '/src/nebula',
cwd + '/src/sql',
cwd + '/src/pool',
cwd + '/src/template',
cwd + '/src/vm',
cwd + '/src/hm',
cwd + '/src/mad',
cwd + '/src/vnm',
cwd + '/src/um',
cwd + '/src/authm',
cwd + '/src/image',
'/usr/include/openssl/',
])
main_env.Append(LIBS=[
env.Append(LIBS=[
'nebula_image',
'nebula_um',
'nebula_vm',
@ -76,33 +36,16 @@ main_env.Append(LIBS=[
'crypto',
])
# MYSQL
main_env.Append(LIBPATH=["/usr/lib/mysql"])
main_env.Append(CPPPATH=["/usr/include/mysql"])
# libxml2
main_env.ParseConfig('xml2-config --libs --cflags')
sqlite=ARGUMENTS.get('sqlite', 'yes')
if sqlite=='yes':
main_env.Append(CPPFLAGS=["-DSQLITE_DB"])
main_env.Append(LIBS=[ 'sqlite3', ])
env.Append(CPPFLAGS=["-DSQLITE_DB"])
env.Append(LIBS=[ 'sqlite3', ])
# MySQL
mysql=ARGUMENTS.get('mysql', 'no')
if mysql=='yes':
main_env.Append(CPPFLAGS=["-DMYSQL_DB"])
main_env.Append(LIBS=[ 'mysqlclient', ])
env.Append(CPPFLAGS=["-DMYSQL_DB"])
env.Append(LIBS=[ 'mysqlclient', ])
# Compile flags
main_env.Append(CPPFLAGS=[
"-g",
"-Wall",
"-Werror"
])
# Linking flags
main_env.Append(LDFLAGS=["-g "])
main_env.Program('test','ImagePoolTest.cc')
env.Program('test','ImagePoolTest.cc')

View File

@ -39,6 +39,29 @@ public:
}
~NebulaTestLCM(){};
TransferManager* create_tm(VirtualMachinePool* vmpool,
HostPool* hpool)
{
vector<const Attribute *> tm_mads;
return new TransferManagerTest(vmpool, hpool, tm_mads);
}
VirtualMachineManager* create_vmm(VirtualMachinePool* vmpool,
HostPool* hpool,
time_t timer_period,
time_t poll_period)
{
vector<const Attribute *> vmm_mads;
return new VirtualMachineManagerTest(vmpool,
hpool,
timer_period,
poll_period,
vmm_mads);
}
};
#endif /*NEBULA_TEST_LCM_H_*/

View File

@ -1,3 +1,5 @@
# SConstruct for src/lcm/test
# -------------------------------------------------------------------------- #
# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) #
# #
@ -14,194 +16,12 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
import os
import sys
import shutil
sys.path.append("../../../share/scons")
from lex_bison import *
Import('env')
# This is the absolute path where the project is located
cwd="../../.."
# Environment that will be applied to each scons child
main_env=Environment()
main_env['ENV']['PATH']=os.environ['PATH']
# snippet borrowed from http://dev.gentoo.org/~vapier/scons-blows.txt
# makes scons aware of build related environment variables
if os.environ.has_key('CC'):
main_env['CC'] = os.environ['CC']
if os.environ.has_key('CFLAGS'):
main_env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS'])
if os.environ.has_key('CXX'):
main_env['CXX'] = os.environ['CXX']
if os.environ.has_key('CXXFLAGS'):
main_env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS'])
if os.environ.has_key('LDFLAGS'):
main_env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS'])
# Add builders for flex and bison
add_lex(main_env)
add_bison(main_env)
# Include dirs
main_env.Append(CPPPATH=[
'.',
cwd+'/include',
cwd+'/include/test',
'/usr/include/cppunit/'
])
# Library dirs
main_env.Append(LIBPATH=[
cwd+'/src/common',
cwd+'/src/log',
cwd+'/src/sql',
cwd+'/src/host',
cwd+'/src/mad',
cwd+'/src/nebula',
cwd+'/src/pool',
cwd+'/src/template',
cwd+'/src/vm',
cwd+'/src/vmm',
cwd+'/src/lcm',
cwd+'/src/tm',
cwd+'/src/dm',
cwd+'/src/im',
cwd+'/src/image',
cwd+'/src/rm',
cwd+'/src/vnm',
cwd+'/src/hm',
cwd+'/src/um',
cwd+'/src/authm',
'.',
])
# Compile flags
main_env.Append(CPPFLAGS=[
"-g",
"-Wall",
"-Werror",
])
# Linking flags
main_env.Append(LINKFLAGS=['-g', '-pthread'])
#######################
# EXTRA CONFIGURATION #
#######################
# SQLITE
sqlite_dir=ARGUMENTS.get('sqlite_dir', 'none')
if sqlite_dir!='none':
main_env.Append(LIBPATH=[sqlite_dir+"/lib"])
main_env.Append(CPPPATH=[sqlite_dir+"/include"])
sqlite=ARGUMENTS.get('sqlite', 'yes')
if sqlite=='yes':
main_env.Append(sqlite='yes')
main_env.Append(CPPFLAGS=["-DSQLITE_DB"])
else:
main_env.Append(sqlite='no')
# MySQL
mysql=ARGUMENTS.get('mysql', 'no')
if mysql=='yes':
main_env.Append(mysql='yes')
main_env.Append(CPPFLAGS=["-DMYSQL_DB"])
else:
main_env.Append(mysql='no')
# xmlrpc
xmlrpc_dir=ARGUMENTS.get('xmlrpc', 'none')
if xmlrpc_dir!='none':
main_env.Append(LIBPATH=[xmlrpc_dir+"/lib"])
main_env.Append(CPPPATH=[xmlrpc_dir+"/include"])
# build lex/bison
build_parsers=ARGUMENTS.get('parsers', 'no')
if build_parsers=='yes':
main_env.Append(parsers='yes')
else:
main_env.Append(parsers='no')
if not main_env.GetOption('clean'):
try:
main_env.ParseConfig('../../../share/scons/get_xmlrpc_config server')
main_env.ParseConfig('../../../share/scons/get_xmlrpc_config client')
if mysql=='yes':
main_env.ParseConfig('mysql_config --cflags --libs')
except Exception, e:
print ""
print "Error searching for xmlrpc-c libraries. Please check this"+\
" things:"
print ""
print " * You have installed development libraries for xmlrpc-c. One"+\
" way to check"
print " this is calling xmlrpc-c-config that is provided with the"+\
" development"
print " package."
print " * Check that the version of xmlrpc-c is at least 1.06. You"+\
" can do this also"
print " calling:"
print " $ xmlrpc-c-config --version"
print " * If all this requirements are already met please send log"+\
" files located in"
print " .xmlrpc_test to the mailing list."
print ""
exit(-1)
else:
main_env.Replace(mysql='yes')
shutil.rmtree('.xmlrpc_test', True)
shutil.rmtree('src/nebula/.xmlrpc_test', True)
shutil.rmtree('src/scheduler/.xmlrpc_test', True)
# libxml2
main_env.ParseConfig('xml2-config --libs --cflags')
# Build LCM and DM toguether in a lib
lib_name='nebula_lcm_dm'
# Sources to generate the library
source_files=[
'../LifeCycleManager.cc',
'../LifeCycleActions.cc',
'../LifeCycleStates.cc',
'../../dm/DispatchManager.cc',
'../../dm/DispatchManagerActions.cc',
'../../dm/DispatchManagerStates.cc',
]
# Build library
main_env.StaticLibrary(lib_name, source_files)
# Build a modified Nebula lib
lib_name='nebula_core_test'
# Sources to generate the library
source_files=[
'../../nebula/test/Nebula.cc',
'../../nebula/test/NebulaTest.cc',
'../../nebula/NebulaTemplate.cc',
'../../../include/test/OneUnitTest.cc',
]
# Build library
main_env.StaticLibrary(lib_name, source_files)
# Build daemon
main_env.Append(LIBS=[
'nebula_lcm_dm',
env.Append(LIBS=[
'nebula_core_test',
'nebula_host',
'nebula_vmm',
'nebula_im',
'nebula_rm',
@ -209,7 +29,6 @@ main_env.Append(LIBS=[
'nebula_um',
'nebula_mad',
'nebula_template',
'nebula_host',
'nebula_vm',
'nebula_vnm',
'nebula_image',
@ -220,20 +39,17 @@ main_env.Append(LIBS=[
'nebula_sql',
'nebula_log',
'nebula_lcm_dm',
'crypto',
'cppunit',
])
# Sources to generate the library
if main_env['sqlite']=='yes':
main_env.Append(LIBS=['sqlite3'])
if env['sqlite']=='yes':
env.Append(LIBS=['sqlite3'])
if main_env['mysql']=='yes':
main_env.Append(LIBS=['mysqlclient'])
if env['mysql']=='yes':
env.Append(LIBS=['mysqlclient'])
if not main_env.GetOption('clean'):
main_env.ParseConfig('../../../share/scons/get_xmlrpc_config server')
main_env.Program('test','LifeCycleManagerTest.cc')
env.Program('test','LifeCycleManagerTest.cc')

View File

@ -14,40 +14,14 @@
# limitations under the License.
# --------------------------------------------------------------------------
import os
import sys
import shutil
sys.path.append("../../../share/scons")
from lex_bison import *
# This is the absolute path where the project is located
cwd="../../../"
# Environment that will be applied to each scons child
main_env=Environment()
main_env['ENV']['PATH']=os.environ['PATH']
# Add builders for flex and bison
add_lex(main_env)
add_bison(main_env)
# Include dirs
main_env.Append(CPPPATH=[
cwd + '/include',
'/usr/include/cppunit/',
])
Import('env')
# Library dirs
main_env.Append(LIBPATH=[
cwd + '/src/common',
cwd + '/src/log',
cwd + '/src/pool',
cwd + '/src/sql',
cwd + '/src/pool/test',
cwd + '/src/nebula',
env.Append(LIBPATH=[
'.'
])
main_env.Append(LIBS=[
env.Append(LIBS=[
'nebula_pool',
'nebula_common',
'nebula_log',
@ -59,29 +33,18 @@ main_env.Append(LIBS=[
'test_object'
])
# Compile flags
main_env.Append(CPPFLAGS=[
"-g",
"-Wall",
"-Werror"
])
# MYSQL
main_env.Append(LIBPATH=["/usr/lib/mysql"])
main_env.Append(CPPPATH=["/usr/include/mysql"])
sqlite=ARGUMENTS.get('sqlite', 'yes')
if sqlite=='yes':
main_env.Append(CPPFLAGS=["-DSQLITE_DB"])
main_env.Append(LIBS=[ 'sqlite3', ])
env.Append(CPPFLAGS=["-DSQLITE_DB"])
env.Append(LIBS=[ 'sqlite3', ])
# MySQL
mysql=ARGUMENTS.get('mysql', 'no')
if mysql=='yes':
main_env.Append(CPPFLAGS=["-DMYSQL_DB"])
main_env.Append(LIBS=[ 'mysqlclient', ])
env.Append(CPPFLAGS=["-DMYSQL_DB"])
env.Append(LIBS=[ 'mysqlclient', ])
main_env.StaticLibrary('test_object', ['TestPoolSQL.cc', 'TestPoolSQL.h'])
main_env.Program('test','pool.cc')
env.StaticLibrary('test_object', ['TestPoolSQL.cc', 'TestPoolSQL.h'])
env.Program('test','pool.cc')

View File

@ -202,10 +202,6 @@ public:
/* ************************************************************************* */
/* ************************************************************************* */
bool OneUnitTest::mysql;
SqlDB * OneUnitTest::db = 0;
string OneUnitTest::db_name = "ONE_test_database";
int main(int argc, char ** argv)
{
return OneUnitTest::main(argc, argv, PoolTest::suite());

View File

@ -248,10 +248,6 @@ public:
/* ************************************************************************* */
/* ************************************************************************* */
bool OneUnitTest::mysql;
SqlDB * OneUnitTest::db = 0;
string OneUnitTest::db_name = "ONE_test_database";
int main(int argc, char ** argv)
{
return OneUnitTest::main(argc, argv, HostXMLTest::suite(),

View File

@ -38,7 +38,8 @@ main_env.Append(LIBPATH=[
cwd+'/..',
cwd+'/../../xml',
cwd+'/../../../../log',
cwd+'/../../../../common'
cwd+'/../../../../common',
cwd+'/../../../../test',
])
# Compile flags
@ -57,7 +58,8 @@ main_env.Append(LIBS=[
'scheduler_xml',
'scheduler_pool',
'nebula_log',
'nebula_common'
'nebula_common',
'nebula_test_common',
])
main_env.Program('test_vm','VirtualMachineXMLTest.cc')

View File

@ -302,10 +302,6 @@ public:
/* ************************************************************************* */
/* ************************************************************************* */
bool OneUnitTest::mysql;
SqlDB * OneUnitTest::db = 0;
string OneUnitTest::db_name = "ONE_test_database";
int main(int argc, char ** argv)
{
return OneUnitTest::main(argc, argv, VirtualMachineXMLTest::suite(),

View File

@ -319,10 +319,6 @@ public:
/* ************************************************************************* */
/* ************************************************************************* */
bool OneUnitTest::mysql;
SqlDB * OneUnitTest::db = 0;
string OneUnitTest::db_name = "ONE_test_database";
int main(int argc, char ** argv)
{
return OneUnitTest::main(argc, argv, ObjectXMLTest::suite());

View File

@ -37,7 +37,8 @@ main_env.Append(CPPPATH=[
main_env.Append(LIBPATH=[
cwd+'/../../../../common',
cwd+'/../../../../log',
'../'
'../',
cwd+'/../../../../test',
])
# Compile flags
@ -55,7 +56,8 @@ main_env.Append(LIBS=[
'cppunit',
'nebula_log',
'scheduler_xml',
'nebula_common'
'nebula_common',
'nebula_test_common',
])
main_env.Program('test_xml','ObjectXMLTest.cc')

View File

@ -15,38 +15,9 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
import os
import sys
import shutil
sys.path.append("../../../share/scons")
from lex_bison import *
Import('env')
# This is the absolute path where the project is located
cwd="../../../"
# Environment that will be applied to each scons child
main_env=Environment()
main_env['ENV']['PATH']=os.environ['PATH']
# Add builders for flex and bison
add_lex(main_env)
add_bison(main_env)
# Include dirs
main_env.Append(CPPPATH=[
cwd + '/include',
'/usr/include/cppunit/'
])
# Library dirs
main_env.Append(LIBPATH=[
cwd + '/src/common',
cwd + '/src/template',
cwd + '/src/nebula',
cwd + '/src/log',
])
main_env.Append(LIBS=[
env.Append(LIBS=[
'nebula_template',
'nebula_common',
'nebula_core',
@ -56,30 +27,16 @@ main_env.Append(LIBS=[
'pthread'
])
# Compile flags
main_env.Append(CPPFLAGS=[
"-g",
"-Wall",
"-Werror"
])
# libxml2
main_env.ParseConfig('xml2-config --libs --cflags')
# MYSQL
main_env.Append(LIBPATH=["/usr/lib/mysql"])
main_env.Append(CPPPATH=["/usr/include/mysql"])
sqlite=ARGUMENTS.get('sqlite', 'yes')
if sqlite=='yes':
main_env.Append(CPPFLAGS=["-DSQLITE_DB"])
main_env.Append(LIBS=[ 'sqlite3', ])
env.Append(CPPFLAGS=["-DSQLITE_DB"])
env.Append(LIBS=[ 'sqlite3', ])
# MySQL
mysql=ARGUMENTS.get('mysql', 'no')
if mysql=='yes':
main_env.Append(CPPFLAGS=["-DMYSQL_DB"])
main_env.Append(LIBS=[ 'mysqlclient', ])
env.Append(CPPFLAGS=["-DMYSQL_DB"])
env.Append(LIBS=[ 'mysqlclient', ])
main_env.Program('test','template.cc')
env.Program('test','template.cc')
#

View File

@ -360,11 +360,6 @@ public:
/* ************************************************************************* */
/* ************************************************************************* */
bool OneUnitTest::mysql;
SqlDB * OneUnitTest::db = 0;
string OneUnitTest::db_name = "ONE_test_database";
int main(int argc, char ** argv)
{
return OneUnitTest::main(argc, argv, TemplateTest::suite());

63
src/test/SConstruct Normal file
View File

@ -0,0 +1,63 @@
# SConstruct for src/test
# -------------------------------------------------------------------------- #
# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #
Import('env')
# Build LCM and DM toguether in a lib
lib_name='nebula_lcm_dm'
# Sources to generate the library
source_files=[
'../lcm/LifeCycleManager.cc',
'../lcm/LifeCycleActions.cc',
'../lcm/LifeCycleStates.cc',
'../dm/DispatchManager.cc',
'../dm/DispatchManagerActions.cc',
'../dm/DispatchManagerStates.cc',
]
# Build library
env.StaticLibrary(lib_name, source_files)
# Build a modified Nebula lib
lib_name='nebula_core_test'
# Sources to generate the library
source_files=[
'Nebula.cc',
'NebulaTest.cc',
'../nebula/NebulaTemplate.cc',
]
# Build library
env.StaticLibrary(lib_name, source_files)
# Build a modified Nebula lib
lib_name='nebula_test_common'
# Sources to generate the library
source_files=[
'OneUnitTest.cc',
]
# Build library
env.StaticLibrary(lib_name, source_files)

View File

@ -14,44 +14,9 @@
# limitations under the License.
# --------------------------------------------------------------------------
import os
import sys
import shutil
sys.path.append("../../../share/scons")
from lex_bison import *
Import('env')
# This is the absolute path where the project is located
cwd="../../../"
# Environment that will be applied to each scons child
main_env=Environment()
main_env['ENV']['PATH']=os.environ['PATH']
# Add builders for flex and bison
add_lex(main_env)
add_bison(main_env)
# Include dirs
main_env.Append(CPPPATH=[
cwd + '/include',
cwd + '/include/test',
'/usr/include/cppunit/',
])
# Library dirs
main_env.Append(LIBPATH=[
cwd + '/src/common',
cwd + '/src/mad',
cwd + '/src/log',
cwd + '/src/nebula',
cwd + '/src/pool',
cwd + '/src/sql',
cwd + '/src/authm',
cwd + '/src/um',
'/usr/include/openssl/',
])
main_env.Append(LIBS=[
env.Append(LIBS=[
'nebula_um',
'nebula_pool',
'nebula_log',
@ -66,32 +31,15 @@ main_env.Append(LIBS=[
'crypto'
])
# Compile flags
main_env.Append(CPPFLAGS=[
"-g",
"-Wall",
"-Werror"
])
# Linking flags
main_env.Append(LDFLAGS=["-g "])
main_env.Program('test','UserPoolTest.cc')
# MYSQL
main_env.Append(LIBPATH=["/usr/lib/mysql"])
main_env.Append(CPPPATH=["/usr/include/mysql"])
# libxml2
main_env.ParseConfig('xml2-config --libs --cflags')
sqlite=ARGUMENTS.get('sqlite', 'yes')
if sqlite=='yes':
main_env.Append(CPPFLAGS=["-DSQLITE_DB"])
main_env.Append(LIBS=[ 'sqlite3', ])
env.Append(CPPFLAGS=["-DSQLITE_DB"])
env.Append(LIBS=[ 'sqlite3', ])
# MySQL
mysql=ARGUMENTS.get('mysql', 'no')
if mysql=='yes':
main_env.Append(CPPFLAGS=["-DMYSQL_DB"])
main_env.Append(LIBS=[ 'mysqlclient', ])
env.Append(CPPFLAGS=["-DMYSQL_DB"])
env.Append(LIBS=[ 'mysqlclient', ])
env.Program('test','UserPoolTest.cc')

View File

@ -14,49 +14,9 @@
# limitations under the License.
# --------------------------------------------------------------------------
import os
import sys
import shutil
sys.path.append("../../../share/scons")
from lex_bison import *
Import('env')
# This is the absolute path where the project is located
cwd="../../../"
# Environment that will be applied to each scons child
main_env=Environment()
main_env['ENV']['PATH']=os.environ['PATH']
# Add builders for flex and bison
add_lex(main_env)
add_bison(main_env)
# Include dirs
main_env.Append(CPPPATH=[
cwd + '/include',
cwd + '/include/test',
'/usr/include/cppunit/',
])
# Library dirs
main_env.Append(LIBPATH=[
cwd + '/src/common',
cwd + '/src/log',
cwd + '/src/nebula',
cwd + '/src/sql',
cwd + '/src/pool',
cwd + '/src/template',
cwd + '/src/vm',
cwd + '/src/hm',
cwd + '/src/authm',
cwd + '/src/mad',
cwd + '/src/vnm',
cwd + '/src/um',
cwd + '/src/image',
'/usr/include/openssl/',
])
main_env.Append(LIBS=[
env.Append(LIBS=[
'nebula_um',
'nebula_vm',
'nebula_hm',
@ -76,33 +36,16 @@ main_env.Append(LIBS=[
'crypto',
])
# MYSQL
main_env.Append(LIBPATH=["/usr/lib/mysql"])
main_env.Append(CPPPATH=["/usr/include/mysql"])
# libxml2
main_env.ParseConfig('xml2-config --libs --cflags')
sqlite=ARGUMENTS.get('sqlite', 'yes')
if sqlite=='yes':
main_env.Append(CPPFLAGS=["-DSQLITE_DB"])
main_env.Append(LIBS=[ 'sqlite3', ])
env.Append(CPPFLAGS=["-DSQLITE_DB"])
env.Append(LIBS=[ 'sqlite3', ])
# MySQL
mysql=ARGUMENTS.get('mysql', 'no')
if mysql=='yes':
main_env.Append(CPPFLAGS=["-DMYSQL_DB"])
main_env.Append(LIBS=[ 'mysqlclient', ])
env.Append(CPPFLAGS=["-DMYSQL_DB"])
env.Append(LIBS=[ 'mysqlclient', ])
# Compile flags
main_env.Append(CPPFLAGS=[
"-g",
"-Wall",
"-Werror"
])
# Linking flags
main_env.Append(LDFLAGS=["-g "])
main_env.Program('test','VirtualMachinePoolTest.cc')
env.Program('test','VirtualMachinePoolTest.cc')

View File

@ -14,45 +14,9 @@
# limitations under the License.
# --------------------------------------------------------------------------
import os
import sys
import shutil
sys.path.append("../../../share/scons")
from lex_bison import *
Import('env')
# This is the absolute path where the project is located
cwd="../../../"
# Environment that will be applied to each scons child
main_env=Environment()
main_env['ENV']['PATH']=os.environ['PATH']
# Add builders for flex and bison
add_lex(main_env)
add_bison(main_env)
# Include dirs
main_env.Append(CPPPATH=[
cwd + '/include',
cwd + '/include/test',
'/usr/include/cppunit/',
])
# Library dirs
main_env.Append(LIBPATH=[
cwd + '/src/authm',
cwd + '/src/common',
cwd + '/src/mad',
cwd + '/src/nebula',
cwd + '/src/sql',
cwd + '/src/log',
cwd + '/src/pool',
cwd + '/src/template',
cwd + '/src/um',
cwd + '/src/vnm',
])
main_env.Append(LIBS=[
env.Append(LIBS=[
'nebula_log',
'nebula_um',
'nebula_vnm',
@ -69,33 +33,16 @@ main_env.Append(LIBS=[
'crypto',
])
# MYSQL
main_env.Append(LIBPATH=["/usr/lib/mysql"])
main_env.Append(CPPPATH=["/usr/include/mysql"])
# libxml2
main_env.ParseConfig('xml2-config --libs --cflags')
sqlite=ARGUMENTS.get('sqlite', 'yes')
if sqlite=='yes':
main_env.Append(CPPFLAGS=["-DSQLITE_DB"])
main_env.Append(LIBS=[ 'sqlite3', ])
env.Append(CPPFLAGS=["-DSQLITE_DB"])
env.Append(LIBS=[ 'sqlite3', ])
# MySQL
mysql=ARGUMENTS.get('mysql', 'no')
if mysql=='yes':
main_env.Append(CPPFLAGS=["-DMYSQL_DB"])
main_env.Append(LIBS=[ 'mysqlclient', ])
env.Append(CPPFLAGS=["-DMYSQL_DB"])
env.Append(LIBS=[ 'mysqlclient', ])
# Compile flags
main_env.Append(CPPFLAGS=[
"-g",
"-Wall",
"-Werror"
])
# Linking flags
main_env.Append(LDFLAGS=["-g "])
main_env.Program('test','VirtualNetworkPoolTest.cc')
env.Program('test','VirtualNetworkPoolTest.cc')