merge together work done for the Testsuite.
- to make it similar to Cehteh's tests, moved my testcode to tests/components - made scons build the errortest and plugin-example as well - scons check will run the suite please note, my implementation work is quite incomplete (warnings, app shuttdown not yet implemented); I hadn't success running the plugintest.
This commit is contained in:
parent
5bde4020cf
commit
06efcf0f77
15 changed files with 94 additions and 25 deletions
28
SConstruct
28
SConstruct
|
|
@ -55,20 +55,23 @@ def setupBasicEnvironment():
|
|||
opts = defineCmdlineOptions()
|
||||
|
||||
env = Environment(options=opts)
|
||||
|
||||
env.Append ( CCCOM=' -std=gnu99') # workaround for a bug: CCCOM currently doesn't honor CFLAGS, only CCFLAGS
|
||||
env.Replace( VERSION=VERSION
|
||||
, SRCDIR=SRCDIR
|
||||
, BINDIR=BINDIR
|
||||
, CPPPATH="#"+SRCDIR # used to find includes, "#" means always absolute to build-root
|
||||
, CPPDEFINES=['-DCINELERRA_VERSION=\\"%s\\"' % VERSION ] # note: make it a list to append further defines
|
||||
, CCFLAGS='-Wall'
|
||||
)
|
||||
|
||||
handleNoBugSwitches(env)
|
||||
|
||||
appendCppDefine(env,'DEBUG','DEBUG', 'NDEBUG')
|
||||
appendCppDefine(env,'OPENGL','USE_OPENGL')
|
||||
appendVal(env,'ARCHFLAGS', 'CPPFLAGS') # for both C and C++
|
||||
appendVal(env,'OPTIMIZE', 'CPPFLAGS', val=' -O3')
|
||||
appendVal(env,'DEBUG', 'CPPFLAGS', val=' -g')
|
||||
appendVal(env,'ARCHFLAGS', 'CCFLAGS') # for both C and C++
|
||||
appendVal(env,'OPTIMIZE', 'CCFLAGS', val=' -O3')
|
||||
appendVal(env,'DEBUG', 'CCFLAGS', val=' -g')
|
||||
|
||||
prepareOptionsHelp(opts,env)
|
||||
opts.Save(OPTIONSCACHEFILE, env)
|
||||
|
|
@ -132,6 +135,8 @@ USAGE: scons [-c] [OPTS] [key=val,...] [TARGETS]
|
|||
|
||||
Special Targets:
|
||||
build : just compile and link
|
||||
testcode: additionally compile the Testsuite
|
||||
check : build and run the Testsuite
|
||||
install : install created artifacts at PREFIX
|
||||
src.tar : create source tarball
|
||||
doc.tar : create developer doc tarball
|
||||
|
|
@ -157,6 +162,10 @@ def configurePlatform(env):
|
|||
print 'Did not find math.h / libm, exiting.'
|
||||
Exit(1)
|
||||
|
||||
if not conf.CheckLibWithHeader('dl', 'dlfcn.h', 'C'):
|
||||
print 'Functions for runtime dynamic loading not available, exiting.'
|
||||
Exit(1)
|
||||
|
||||
if not conf.CheckLibWithHeader('nobugmt', 'nobug.h', 'C'):
|
||||
print 'Did not find NoBug [http://www.pipapo.org/pipawiki/NoBug], exiting.'
|
||||
Exit(1)
|
||||
|
|
@ -210,21 +219,20 @@ def defineBuildTargets(env, artifacts):
|
|||
setup sub-environments with special build options if necessary.
|
||||
We use a custom function to declare a whole tree of srcfiles.
|
||||
"""
|
||||
cinobj = ( srcSubtree(env,'backend')
|
||||
+ srcSubtree(env,'proc')
|
||||
+ srcSubtree(env,'common')
|
||||
# + srcSubtree(env,'lib')
|
||||
cinobj = ( srcSubtree(env,'$SRCDIR/backend')
|
||||
+ srcSubtree(env,'$SRCDIR/proc')
|
||||
+ srcSubtree(env,'$SRCDIR/common')
|
||||
+ srcSubtree(env,'$SRCDIR/lib')
|
||||
)
|
||||
applobj = cinobj + env.Object('$SRCDIR/main.cpp')
|
||||
testobj = srcSubtree(env,'test/*', isShared=False)
|
||||
plugobj = srcSubtree(env,'plugin', isShared=True)
|
||||
plugobj = srcSubtree(env,'$SRCDIR/plugin', isShared=True)
|
||||
|
||||
artifacts['cinelerra'] = env.Program('$BINDIR/cinelerra', applobj)
|
||||
artifacts['plugins'] = env.SharedLibrary('$BINDIR/cinelerra-plugin', plugobj)
|
||||
|
||||
# call subdir SConscript(s) for independent components
|
||||
SConscript(dirs=[SRCDIR+'/tool'], exports='env artifacts')
|
||||
SConscript(dirs=[TESTDIR], exports='env artifacts cinobj testobj')
|
||||
SConscript(dirs=[TESTDIR], exports='env artifacts cinobj')
|
||||
|
||||
|
||||
def defineInstallTargets(env, artifacts):
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@ def isHelpRequest():
|
|||
|
||||
def srcSubtree(env,tree,isShared=False, **args):
|
||||
""" convienience wrapper: scans the given subtree, which is
|
||||
to be located within $SRCDIR, find all source files and
|
||||
relative to the current SConscript, find all source files and
|
||||
declare them as Static or SharedObjects for compilation
|
||||
"""
|
||||
root = env.subst('$SRCDIR/%s' % tree) # expand $SRCDIR
|
||||
root = env.subst(tree) # expand Construction Vars
|
||||
if isShared:
|
||||
builder = lambda f: env.SharedObject(f, **args)
|
||||
else:
|
||||
|
|
|
|||
4
tests/.gitignore
vendored
Normal file
4
tests/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
,*
|
||||
mainsuite
|
||||
errortest
|
||||
plugin-example
|
||||
12
tests/50components.tests
Normal file
12
tests/50components.tests
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
TESTING "Component Test Suite" ./mainsuite
|
||||
|
||||
TEST "Fac test" Factory_test <<END
|
||||
return: 0
|
||||
END
|
||||
|
||||
TEST "Hello test" HelloWorld_test <<END
|
||||
out: This is how the world ends...
|
||||
return: 0
|
||||
END
|
||||
|
||||
|
|
@ -3,14 +3,55 @@
|
|||
## SConscript - SCons buildscript for the Testsuite (called by SConstruct)
|
||||
##
|
||||
|
||||
Import('env','artifacts','cinobj','testobj')
|
||||
import os
|
||||
from Buildhelper import *
|
||||
|
||||
# build an application running the testsuite
|
||||
artifacts['testsuite'] = env.Program('mainsuite', cinobj + testobj + ['#$SRCDIR/test/mainsuite.cpp'])
|
||||
Import('env','artifacts','cinobj')
|
||||
|
||||
|
||||
# build objects for the testcases...
|
||||
#
|
||||
env = env.Clone()
|
||||
env.Append(CPPPATH = ['components','examples'])
|
||||
|
||||
testobj = srcSubtree(env,'components/*', isShared=False)
|
||||
|
||||
example = env.StaticLibrary('examples/cin3example', ['#$SRCDIR/lib/error.o','#$SRCDIR/lib/plugin.o'])
|
||||
plugin = env.StaticLibrary('example_plugin.la', ['examples/example_plugin.c'])
|
||||
|
||||
|
||||
# build test applications
|
||||
#
|
||||
envp = env.Clone() # special Environment including libs for the plugin-test
|
||||
envp.Append(LIBS = [example,plugin])
|
||||
|
||||
artifacts['testsuite'] = ts = ( env.Program('mainsuite', cinobj + testobj + ['components/mainsuite.cpp'])
|
||||
+ envp.Program('errortest', example + ['examples/errortest.c'] )
|
||||
+ envp.Program('plugin-example', example + plugin + ['examples/plugin_main.c'])
|
||||
)
|
||||
# TODO: we could apply much more "magic" here
|
||||
# - organize the source of testcases more systematically
|
||||
# - build /every/ $TESTDIR/*.cpp into an application
|
||||
# - link the testobj dynamically
|
||||
# - install additionally scripts into tests-dir if desired
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
# actually run the Testsuite
|
||||
#
|
||||
# - the product of running the Testsuite is the ",testlog"
|
||||
# - it depends on all artifacts defined as "ts" above
|
||||
#
|
||||
runTs = env.Command(',testlog', ts, "./test.sh", chdir=1)
|
||||
|
||||
|
||||
#
|
||||
# define Phony targets
|
||||
# - 'scons testcode' triggers building of the Testsuite
|
||||
# - 'scons check' triggers building and running
|
||||
#
|
||||
env.Alias('testcode', ts )
|
||||
env.Alias('check', runTs )
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
* *****************************************************/
|
||||
|
||||
|
||||
#include "test/helper/run.hpp"
|
||||
#include "helper/run.hpp"
|
||||
|
||||
|
||||
namespace cinelerra
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
#include <iostream>
|
||||
#include "test/helper/run.hpp"
|
||||
#include "helper/run.hpp"
|
||||
|
||||
|
||||
namespace cinelerra
|
||||
|
|
@ -40,7 +40,7 @@ namespace cinelerra
|
|||
|
||||
void greeting()
|
||||
{
|
||||
std::cout << "This is how the world ends...\n\n";
|
||||
std::cout << "This is how the world ends...\n";
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "test/helper/suite.hpp"
|
||||
#include "helper/suite.hpp"
|
||||
|
||||
|
||||
namespace test
|
||||
|
|
@ -48,6 +48,7 @@ namespace test
|
|||
class Test
|
||||
{
|
||||
public:
|
||||
virtual ~Test() {}
|
||||
virtual void run(Arg arg) = 0;
|
||||
};
|
||||
|
||||
|
|
@ -57,6 +58,7 @@ namespace test
|
|||
class Launcher
|
||||
{
|
||||
public:
|
||||
virtual ~Launcher() {}
|
||||
virtual auto_ptr<Test> operator() () = 0;
|
||||
};
|
||||
|
||||
|
|
@ -28,8 +28,8 @@
|
|||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include "test/helper/suite.hpp"
|
||||
#include "test/helper/run.hpp"
|
||||
#include "helper/suite.hpp"
|
||||
#include "helper/run.hpp"
|
||||
#include "common/error.hpp"
|
||||
#include "common/util.hpp"
|
||||
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "test/helper/suite.hpp"
|
||||
#include "helper/suite.hpp"
|
||||
|
||||
|
||||
/** run all tests or any single test specified in the first
|
||||
|
|
@ -19,10 +19,12 @@
|
|||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <error.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "lib/error.h"
|
||||
|
||||
|
||||
CINELERRA_ERROR_DEFINE(TEST, "test error");
|
||||
|
||||
int
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "plugin.h"
|
||||
#include "lib/plugin.h"
|
||||
|
||||
CINELERRA_INTERFACE(hello, 1,
|
||||
CINELERRA_INTERFACE_PROTO(void, hello, (void))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
|
||||
#include "plugin.h"
|
||||
#include "lib/plugin.h"
|
||||
#include "hello_interface.h"
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue