wrote a very simple Test-Suite runner and provided a Tests source tree
This commit is contained in:
parent
8f35701ca8
commit
45c2167700
14 changed files with 743 additions and 26 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,4 +1,5 @@
|
|||
/wiki/backups/*
|
||||
/tests/*
|
||||
*~
|
||||
*.tar.*
|
||||
.sconf_temp
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ OPTIONSCACHEFILE = 'optcache'
|
|||
CUSTOPTIONSFILE = 'custom-options'
|
||||
SRCDIR = 'src'
|
||||
BINDIR = 'src/bin'
|
||||
TESTDIR = 'tests'
|
||||
VERSION = '3+alpha.01'
|
||||
#-----------------------------------Configuration
|
||||
|
||||
|
|
@ -57,7 +58,7 @@ def setupBasicEnvironment():
|
|||
env.Replace( VERSION=VERSION
|
||||
, SRCDIR=SRCDIR
|
||||
, BINDIR=BINDIR
|
||||
, CPPPATH=SRCDIR # used to find includes
|
||||
, CPPPATH="#"+SRCDIR # used to find includes, "#" means always absolute to build-root
|
||||
)
|
||||
|
||||
appendCppDefine(env,'DEBUG','DEBUG')
|
||||
|
|
@ -196,6 +197,7 @@ def defineBuildTargets(env, artifacts):
|
|||
# + srcSubtree(env,'lib')
|
||||
+ env.Object('$SRCDIR/main.cpp')
|
||||
)
|
||||
testobj = srcSubtree(env,'test/*', isShared=False)
|
||||
plugobj = srcSubtree(env,'plugin', isShared=True)
|
||||
|
||||
artifacts['cinelerra'] = env.Program('$BINDIR/cinelerra', cinobj)
|
||||
|
|
@ -203,7 +205,7 @@ def defineBuildTargets(env, artifacts):
|
|||
|
||||
# call subdir SConscript(s) for independent components
|
||||
SConscript(dirs=[SRCDIR+'/tool'], exports='env artifacts')
|
||||
|
||||
SConscript(dirs=[TESTDIR], exports='env artifacts testobj')
|
||||
|
||||
|
||||
def defineInstallTargets(env, artifacts):
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
import fnmatch
|
||||
import re
|
||||
import tarfile
|
||||
|
|
@ -62,16 +63,28 @@ def srcSubtree(env,tree,isShared=False, **args):
|
|||
|
||||
SRCPATTERNS = ['*.c','*.cpp','*.cc']
|
||||
|
||||
def scanSrcSubtree(root):
|
||||
""" scan the given subtree for source filesnames
|
||||
def scanSrcSubtree(roots):
|
||||
""" first expand (possible) wildcards and filter out non-dirs.
|
||||
Then scan the given subtree for source filesnames
|
||||
(python generator function)
|
||||
"""
|
||||
for (dir,_,files) in os.walk(root):
|
||||
if dir.startswith('./'):
|
||||
dir = dir[2:]
|
||||
for p in SRCPATTERNS:
|
||||
for f in fnmatch.filter(files, p):
|
||||
yield os.path.join(dir,f)
|
||||
for root in globRootdirs(roots):
|
||||
for (dir,_,files) in os.walk(root):
|
||||
if dir.startswith('./'):
|
||||
dir = dir[2:]
|
||||
for p in SRCPATTERNS:
|
||||
for f in fnmatch.filter(files, p):
|
||||
yield os.path.join(dir,f)
|
||||
|
||||
|
||||
|
||||
def globRootdirs(roots):
|
||||
""" helper: expand shell wildcards and filter the resulting list,
|
||||
so that it only contains existing directories
|
||||
"""
|
||||
filter = lambda f: os.path.isdir(f) and os.path.exists(f)
|
||||
roots = glob.glob(roots)
|
||||
return (dir for dir in roots if filter(dir) )
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -107,6 +107,19 @@ namespace cinelerra
|
|||
};
|
||||
|
||||
|
||||
/** another convienience instantiiation: auto_ptr-Factory,
|
||||
* actually creating a subclass of the returned type
|
||||
*/
|
||||
template<class T, class TImpl>
|
||||
class SubclassPtr : public Factory<T>
|
||||
{
|
||||
typedef std::auto_ptr<T> aP;
|
||||
|
||||
public:
|
||||
aP operator() (){ return aP (new TImpl ); };
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace factory
|
||||
|
||||
|
|
|
|||
54
src/test/common/factorytest.cpp
Normal file
54
src/test/common/factorytest.cpp
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
Factory(Test) - unittest for the object creating factory
|
||||
|
||||
Copyright (C) CinelerraCV
|
||||
2007, Christian Thaeter <ct@pipapo.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
* *****************************************************/
|
||||
|
||||
|
||||
#include "test/helper/run.hpp"
|
||||
|
||||
|
||||
namespace cinelerra
|
||||
{
|
||||
namespace test
|
||||
{
|
||||
|
||||
/**
|
||||
* Target object to be created by the Test-Factory
|
||||
*/
|
||||
class TargetObj
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
class Factory_test : public Test
|
||||
{
|
||||
virtual void run(Arg arg)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/** Register this test class to be invoked in some test groups (suites) */
|
||||
Launch<Factory_test> run_Factory_test("Factory_test","unit common");
|
||||
|
||||
|
||||
|
||||
} // namespace test
|
||||
|
||||
} // namespace cinelerra
|
||||
55
src/test/common/helloworldtest.cpp
Normal file
55
src/test/common/helloworldtest.cpp
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
HelloWorld(Test) - how to use this test framework...
|
||||
|
||||
Copyright (C) CinelerraCV
|
||||
2007, Christian Thaeter <ct@pipapo.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
* *****************************************************/
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include "test/helper/run.hpp"
|
||||
|
||||
|
||||
namespace cinelerra
|
||||
{
|
||||
namespace test
|
||||
{
|
||||
|
||||
|
||||
class HelloWorld_test : public Test
|
||||
{
|
||||
virtual void run(Arg arg)
|
||||
{
|
||||
greeting();
|
||||
}
|
||||
|
||||
void greeting()
|
||||
{
|
||||
std::cout << "This is how the world ends...\n\n";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** Register this test class to be invoked in some test groups (suites) */
|
||||
Launch<HelloWorld_test> run_HelloWorld_test("HelloWorld_test","unit common");
|
||||
|
||||
|
||||
} // namespace test
|
||||
|
||||
} // namespace cinelerra
|
||||
92
src/test/helper/run.hpp
Normal file
92
src/test/helper/run.hpp
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
RUN.hpp - helper class for grouping, registering and invoking testcases
|
||||
|
||||
Copyright (C) CinelerraCV
|
||||
2007, Christian Thaeter <ct@pipapo.org>
|
||||
Hermann Vosseler <Ichthyostega@web.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TESTHELPER_RUN_H
|
||||
#define TESTHELPER_RUN_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "common/factory.hpp"
|
||||
#include "test/helper/suite.hpp"
|
||||
|
||||
|
||||
namespace test
|
||||
{
|
||||
|
||||
using std::string;
|
||||
using std::auto_ptr;
|
||||
using cinelerra::Factory;
|
||||
using cinelerra::factory::SubclassPtr;
|
||||
|
||||
typedef std::vector<string> * Arg;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Abstract Base Class for all testcases.
|
||||
* Typically, such testcases are created by a Launcher.
|
||||
*/
|
||||
class Test
|
||||
{
|
||||
public:
|
||||
virtual void run(Arg arg) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** interface: generic testcase creating functor. */
|
||||
class Launcher
|
||||
{
|
||||
public:
|
||||
virtual auto_ptr<Test> operator() () = 0;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Helper class for running a collection of tests.
|
||||
* Launch objects are functors, which create on
|
||||
* invocation an instance of the Test class
|
||||
* they were created with. Creating such a
|
||||
* Test Launcher internally registers this
|
||||
* testcase with the Testsuite-Class,
|
||||
* optionally under several groups
|
||||
* (=categories, suite selections).
|
||||
* @note a subclass of Launcher
|
||||
*/
|
||||
template<class TEST>
|
||||
class Launch : public Launcher
|
||||
{
|
||||
public:
|
||||
Launch (string testID, string groups) { Suite::enroll (this,testID,groups); };
|
||||
virtual auto_ptr<Test> operator() () { return auto_ptr<Test> (new TEST ); };
|
||||
};
|
||||
|
||||
} // namespace test
|
||||
|
||||
// make them global for convienience
|
||||
using ::test::Arg;
|
||||
using ::test::Test;
|
||||
using ::test::Launch;
|
||||
|
||||
#endif
|
||||
171
src/test/helper/suite.cpp
Normal file
171
src/test/helper/suite.cpp
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
/*
|
||||
Suite - helper class for running collections of tests
|
||||
|
||||
Copyright (C) CinelerraCV
|
||||
2007, Christian Thaeter <ct@pipapo.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
* *****************************************************/
|
||||
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <tr1/memory>
|
||||
#include "test/helper/suite.hpp"
|
||||
#include "test/helper/run.hpp"
|
||||
|
||||
#include <iostream> /////////////////////////TODO: Debug
|
||||
#include <sstream>
|
||||
|
||||
namespace test
|
||||
{
|
||||
using std::map;
|
||||
using std::vector;
|
||||
using std::auto_ptr;
|
||||
using std::tr1::shared_ptr;
|
||||
|
||||
typedef map<string, Launcher*> TestMap;
|
||||
typedef shared_ptr<TestMap> PTestMap;
|
||||
typedef map<string,PTestMap> GroupMap;
|
||||
|
||||
|
||||
/** helper to collect and manage the test cases.
|
||||
* Every testcase class should create a Launch instance
|
||||
* which causes a call to Suite::enroll(), so we can add a
|
||||
* pointer to this Launcher into a map indexed by the
|
||||
* provided testIDs and groupIDs.
|
||||
* This enables us to build a Suite instance for any
|
||||
* requested group and then instantiiate and invoke
|
||||
* individual testcases accordingly.
|
||||
*/
|
||||
class Registry
|
||||
{
|
||||
auto_ptr<GroupMap> groups;
|
||||
public:
|
||||
Registry() : groups(new GroupMap ) {};
|
||||
PTestMap& getGroup (string grpID) { return (*groups)[grpID]; };
|
||||
void add2group (Launcher* test, string testID, string groupID);
|
||||
};
|
||||
|
||||
void Registry::add2group (Launcher* test, string testID, string groupID)
|
||||
{
|
||||
// TODO: ASSERT test!=null, testID.length > 0 ...
|
||||
PTestMap& group = getGroup(groupID);
|
||||
if (!group)
|
||||
group.reset( new TestMap );
|
||||
(*group)[testID] = test;
|
||||
}
|
||||
|
||||
Registry testcases;
|
||||
|
||||
|
||||
|
||||
|
||||
/** register the given test-launcher, so it can be later accessed
|
||||
* either as a member of one of the specified groups, or direcly
|
||||
* by its testID. Any test is automatically added to the groupID
|
||||
* #ALLGROUP
|
||||
* @param groups List of group-IDs selected by whitespace
|
||||
*/
|
||||
void Suite::enroll (Launcher* test, string testID, string groups)
|
||||
{
|
||||
// TODO learn to use NoBug for logging
|
||||
std::cerr << "enroll( testID=" << testID << ")\n";
|
||||
// TODO: ASSERT test!=null, testID.length() > 0...
|
||||
|
||||
std::istringstream ss(groups);
|
||||
string group;
|
||||
while (ss >> group )
|
||||
testcases.add2group(test, testID, group);
|
||||
|
||||
// Magic: allways add any testcas to groupID="ALL"
|
||||
testcases.add2group(test,testID, ALLGROUP);
|
||||
}
|
||||
|
||||
/** "magic" groupID containing all registered testcases */
|
||||
const string Suite::ALLGROUP = "ALL";
|
||||
|
||||
|
||||
|
||||
/** create a suite comprised of all the testcases
|
||||
* previously @link #enroll() registered @endlink with this
|
||||
* this group.
|
||||
* @see #run() running tests in a Suite
|
||||
*/
|
||||
Suite::Suite(string groupID)
|
||||
: groupID_(groupID)
|
||||
{
|
||||
std::cerr << "Suite( groupID="<< groupID << ")\n";
|
||||
if (!testcases.getGroup(groupID))
|
||||
throw "empty testsuite"; /////////// TODO Errorhandling!
|
||||
}
|
||||
|
||||
|
||||
/** run all testcases contained in this Suite.
|
||||
* The first argument in the commandline, if present, will select
|
||||
* one single testcase with a matching ID.
|
||||
*/
|
||||
void Suite::run (int argc, char* argv[])
|
||||
{
|
||||
/////////////////////////////////////////////////////TODO:DEBUG
|
||||
std::cerr << "Suite::run( (" << argc << "[" ;
|
||||
for ( int i=0; i<argc; ++i )
|
||||
std::cerr << argv[i] << ",";
|
||||
std::cerr << "]\n";
|
||||
/////////////////////////////////////////////////////TODO:DEBUG
|
||||
|
||||
PTestMap tests = testcases.getGroup(groupID_);
|
||||
//TODO ASSERT tests!=null
|
||||
|
||||
if (argc >= 2)
|
||||
{
|
||||
if (Launcher* test = (*tests)[argv[1]])
|
||||
{
|
||||
// first cmdline argument denotes a valid
|
||||
// testcase registered in this group:
|
||||
// go ahead and invoke just this test.
|
||||
if (argc > 2)
|
||||
{ // pass additional cmdline as vector
|
||||
vector<string> arglist(argc-2);
|
||||
for ( int i=2; i<argc; ++i )
|
||||
arglist.push_back(string(argv[i]));
|
||||
|
||||
// run single Testcase with provided arguments
|
||||
(*test)()->run(&arglist);
|
||||
}
|
||||
else
|
||||
(*test)()->run(0); // without additional argumens
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// no test-ID was specified.
|
||||
// instantiiate all tests cases and execute them.
|
||||
for ( TestMap::iterator i=tests->begin(); i!=tests->end(); ++i )
|
||||
if (i->second)
|
||||
{
|
||||
std::cout << " ----------"<< i->first<< "----------\n";
|
||||
Launcher& test = *(i->second);
|
||||
test()->run(0); // without cmdline arguments
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace test
|
||||
61
src/test/helper/suite.hpp
Normal file
61
src/test/helper/suite.hpp
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
SUITE.hpp - helper class for running collections of tests
|
||||
|
||||
Copyright (C) CinelerraCV
|
||||
2007, Christian Thaeter <ct@pipapo.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TESTHELPER_SUITE_H
|
||||
#define TESTHELPER_SUITE_H
|
||||
|
||||
#include <string>
|
||||
#include "common/factory.hpp"
|
||||
|
||||
|
||||
|
||||
namespace test
|
||||
{
|
||||
using std::string;
|
||||
|
||||
// Forward decls needed for run.hpp
|
||||
class Test;
|
||||
class Launcher;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Helper class for running a collection of tests.
|
||||
*
|
||||
*/
|
||||
class Suite
|
||||
{
|
||||
string groupID_;
|
||||
|
||||
public:
|
||||
Suite (string groupID);
|
||||
void run (int argc, char* argv[]);
|
||||
static void enroll (Launcher *test, string testID, string groups);
|
||||
|
||||
static const string ALLGROUP;
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace test
|
||||
#endif
|
||||
36
src/test/mainsuite.cpp
Normal file
36
src/test/mainsuite.cpp
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
mainsuite.cpp - "the" cinelerra3 self test suite
|
||||
|
||||
Copyright (C) CinelerraCV
|
||||
2007, Christian Thaeter <ct@pipapo.org>
|
||||
Hermann Vosseler <Ichthyostega@web.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "test/helper/suite.hpp"
|
||||
|
||||
|
||||
/** run all tests or any single test specified in the first
|
||||
* cmd line argument.
|
||||
* Note: to ease debugging, we don't catch any exceptions.
|
||||
*/
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
test::Suite suite (test::Suite::ALLGROUP);
|
||||
suite.run(argc,argv);
|
||||
return 0;
|
||||
}
|
||||
16
tests/SConscript
Normal file
16
tests/SConscript
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# -*- python -*-
|
||||
##
|
||||
## SConscript - SCons buildscript for the Testsuite (called by SConstruct)
|
||||
##
|
||||
|
||||
Import('env','artifacts','testobj')
|
||||
|
||||
# build an application running the testsuite
|
||||
artifacts['testsuite'] = env.Program('mainsuite',testobj + ['#$SRCDIR/test/mainsuite.cpp'])
|
||||
|
||||
# TODO: we could apply much more "magic" here
|
||||
# - build /every/ $TESTDIR/*.cpp into an application
|
||||
# - link the testobj dynamically
|
||||
# - install additionally scripts into tests-dir if desired
|
||||
|
||||
|
||||
154
tests/test.sh
Executable file
154
tests/test.sh
Executable file
|
|
@ -0,0 +1,154 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# tests/test.sh - run all defined automatic tests
|
||||
#
|
||||
#
|
||||
# Copyright (C) CinelerraCV
|
||||
# 2007, Christian Thaeter <ct@pipapo.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
###################################################################
|
||||
|
||||
|
||||
# TESTMODE=FULL yet unimplemented
|
||||
# run all tests, PLANNED which fail count as error
|
||||
#
|
||||
# TESTMODE=FAST
|
||||
# run only tests which recently failed
|
||||
|
||||
arg0="$0"
|
||||
srcdir=$(dirname "$arg0")
|
||||
|
||||
ulimit -S -t 1 -v 524288
|
||||
valgrind=""
|
||||
if [ "$VALGRINDFLAGS" = 'DISABLE' ]; then
|
||||
echo "valgrind explicit disabled"
|
||||
else
|
||||
if [ "$(which valgrind)" ]; then
|
||||
valgrind="$(which valgrind) --suppressions=$srcdir/../valgrind.sup --leak-check=yes --show-reachable=yes -q $VALGRINDFLAGS"
|
||||
ulimit -S -t 10
|
||||
else
|
||||
echo "no valgrind found, go without it"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo
|
||||
echo ================ $0 ================
|
||||
|
||||
TESTCNT=0
|
||||
SKIPCNT=0
|
||||
FAILCNT=0
|
||||
|
||||
if test -f ,testlog; then
|
||||
mv ,testlog ,testlog.pre
|
||||
else
|
||||
touch ,testlog.pre
|
||||
fi
|
||||
|
||||
date >,testlog
|
||||
|
||||
function TEST()
|
||||
{
|
||||
name="$1"
|
||||
shift
|
||||
cat >,cmp
|
||||
echo -n "" >,out
|
||||
echo -n "TEST $name: "
|
||||
echo -en "\nTEST $name: $* " >>,testlog
|
||||
|
||||
case $TESTMODE in
|
||||
*FAST*)
|
||||
if grep "^TEST $name: .* FAILED" ,testlog.pre >&/dev/null; then
|
||||
MSGOK=" (fixed)"
|
||||
MSGFAIL=" (still broken)"
|
||||
elif grep "^TEST $name: .* \\(SKIPPED (ok)\\|OK\\)" ,testlog.pre >&/dev/null; then
|
||||
echo ".. SKIPPED (ok)"
|
||||
echo ".. SKIPPED (ok)" >>,testlog
|
||||
SKIPCNT=$(($SKIPCNT + 1))
|
||||
TESTCNT=$(($TESTCNT + 1))
|
||||
return
|
||||
else
|
||||
MSGOK=" (new)"
|
||||
MSGFAIL=" (new)"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
MSGOK=""
|
||||
MSGFAIL=""
|
||||
;;
|
||||
esac
|
||||
|
||||
TESTCNT=$(($TESTCNT + 1))
|
||||
if $valgrind $TESTBIN "$@" 2>&1 | tee ,tmp | grep -v ': \(TRACE\|INFO\|NOTICE\|WARNING\|ERR\):' | cmp ,cmp - &>/dev/null; then
|
||||
echo ".. OK$MSGOK"
|
||||
echo ".. OK$MSGOK" >>,testlog
|
||||
else
|
||||
echo ".. FAILED$MSGFAIL";
|
||||
echo ".. FAILED$MSGFAIL" >>,testlog
|
||||
grep -v ': \(TRACE\|INFO\|NOTICE\|WARNING\|ERR\):' <,tmp >,out
|
||||
diff -ua ,cmp ,out >>,testlog
|
||||
# grep 'DEBUG:\|==.*==' <,tmp >>,testlog
|
||||
cat ,tmp >>,testlog
|
||||
echo END >>,testlog
|
||||
FAILCNT=$(($FAILCNT + 1))
|
||||
case $TESTMODE in
|
||||
*FIRSTFAIL*)
|
||||
break 2
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
function PLANNED()
|
||||
{
|
||||
echo -n "PLANNED $1: "
|
||||
echo -en "\nPLANNED $* " >>,testlog
|
||||
echo ".. SKIPPED (planned)"
|
||||
echo ".. SKIPPED (planned)" >>,testlog
|
||||
SKIPCNT=$(($SKIPCNT + 1))
|
||||
TESTCNT=$(($TESTCNT + 1))
|
||||
}
|
||||
|
||||
function RUNTESTS()
|
||||
{
|
||||
for i in $srcdir/*.tests; do
|
||||
source $i
|
||||
done
|
||||
echo
|
||||
rm ,cmp ,out ,tmp
|
||||
if [ $FAILCNT = 0 ]; then
|
||||
echo " ... PASSED $(($TESTCNT - $SKIPCNT)) TESTS, $SKIPCNT SKIPPED"
|
||||
#rm ,testlog
|
||||
else
|
||||
echo " ... SUCCEDED $(($TESTCNT - $FAILCNT - $SKIPCNT)) TESTS"
|
||||
echo " ... FAILED $FAILCNT TESTS"
|
||||
echo " ... SKIPPED $SKIPCNT TESTS"
|
||||
echo " see ',testlog' for details"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function TESTING()
|
||||
{
|
||||
echo
|
||||
echo "$1"
|
||||
TESTBIN=$2
|
||||
}
|
||||
|
||||
RUNTESTS
|
||||
|
||||
# arch-tag: f4d06a47-6e17-40de-bba8-17240ae3f435
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ DAMAGE.
|
|||
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml'/>
|
||||
<!--}}}-->
|
||||
|
||||
<style type="text/css">#contentWrapper {display:none;}</style><div id="SplashScreen" style="border: 3px solid #ccc; display: block; text-align: center; width: 320px; margin: 100px auto; padding: 50px; color:#000; font-size: 28px; font-family:Tahoma; background-color:#eee;"><b>My TiddlyWiki</b> is loading<blink> ...</blink><br><br><span style="font-size: 14px; color:red;">Requires Javascript.</span></div>
|
||||
<style type="text/css">#contentWrapper {display:none;}</style><div id="SplashScreen" style="border: 3px solid #ccc; display: block; text-align: center; width: 320px; margin: 100px auto; padding: 50px; color:#000; font-size: 28px; font-family:Tahoma; background-color:#eee;"><b>Cinelerra TiddlyWiki</b> is loading<blink> ...</blink><br><br><span style="font-size: 14px; color:red;">Requires Javascript.</span></div>
|
||||
<!--PRE-HEAD-END-->
|
||||
<title> Cinelerra3 - Distributed Developer Wiki </title>
|
||||
<style type="text/css">
|
||||
|
|
@ -747,7 +747,18 @@ config.macros.timeline.handler = function(place,macroName,params,wikifier,paramS
|
|||
}
|
||||
//}}}</pre>
|
||||
</div>
|
||||
<div title="BuildSystem" modifier="Ichthyostega" modified="200708051534" created="200708051532" tags="organization buildsys" changecount="3">
|
||||
<div title="BuildDependenceis" modifier="Ichthyostega" modified="200708120113" created="200708120103" tags="organization buildsys" changecount="3">
|
||||
<pre>for __Building__
|
||||
* gcc (4.1), glibc6 (2.3), libstdc++6 (4.1)
|
||||
* [[build system|BuildSystem]] dependencies: SCons (0.96.90), Python (2.3)
|
||||
* NoBug for Logging, Tracing, Asserting (can be obtained from [[Pipapo.org|http://www.pipapo.org/pipawiki/NoBug]])
|
||||
* std::tr1 &mdash; esp. for the former BOOST::shared_ptr (which is now proposed standard)
|
||||
* BOOST
|
||||
//usually, newer versions are OK//
|
||||
|
||||
for __Running__</pre>
|
||||
</div>
|
||||
<div title="BuildSystem" modifier="Ichthyostega" modified="200708120101" created="200708051532" tags="organization buildsys" changecount="4">
|
||||
<pre>July 2007 we agreed to try out several Build Systems in real world usage, to get a better feel on the maintenance costs of each.
|
||||
* SCons
|
||||
* AutoTools
|
||||
|
|
@ -755,6 +766,7 @@ config.macros.timeline.handler = function(place,macroName,params,wikifier,paramS
|
|||
!Used Functionality
|
||||
* (re)building with reliable dependency checks
|
||||
* environment checks ("configure")
|
||||
* executing self-test suite
|
||||
* provide central interface for setting switches and configuration options
|
||||
* installing of some or all created artifacts</pre>
|
||||
</div>
|
||||
|
|
@ -795,10 +807,10 @@ This distributed wiki might be used instead the pipapo.org wiki, investigate tha
|
|||
Wiki works. It is simple to use and just flexible enough to handle the task. I don't go to install any other software for such tasks on my server. While the design progresses I'd propose to move our work into git repositories and eventually phase this wiki pages out anyways. I'd rather like to start out distributed/git right away .. but git gives us only a fine storage layer, for a design process we need some good presentation layer (later when using git and starting the implementation everyones favorite editor serves for that) I have no better ideas yet to solve the presentation problem other than using this wiki (or maybe Bouml).
|
||||
</pre>
|
||||
</div>
|
||||
<div title="Cinelerra3Wiki" modifier="CehTeh" modified="200708101843" created="200706172308" tags="portal" changecount="22">
|
||||
<pre>This 'index.html' becomes the entry point of some tiddlywikis managed under git. There is a 'empty.html' in the same folder serving as template for generating new wikis. Please refrain from editing it.
|
||||
<div title="Cinelerra3Wiki" modifier="Ichthyostega" modified="200708120126" created="200706172308" tags="portal" changecount="27">
|
||||
<pre>This is the entry point to several [[TiddlyWiki]]-Pages containing the developer and design documentation for Cinelrra-3.
|
||||
|
||||
* I started a GitNotes where we will collect some information about git, howto and special setups
|
||||
* Cehteh started GitNotes where we will collect some information about git, howto and special setups
|
||||
* since we prefer gpg signed tags in git and not each developer knows gpg well here is a Micro-GPG-HowTo
|
||||
* we maintain (semi-) final design docs in DesignDocumentation
|
||||
|
||||
|
|
@ -809,7 +821,7 @@ Please end your tiddlers in a newline, this makes merging in git easier since th
|
|||
to get started, we create design drafts emphasizing different aspects and regions of Cinelerra-3
|
||||
|
||||
* Ichthyo focuses mainly on the Render Engine and its interconnection to the EDL, [[see this separate page|renderengine.html]]
|
||||
* cehteh works on the data backend draft, see [[this page|backend.html]]
|
||||
* Cehteh works on the data backend draft, see [[this page|backend.html]]
|
||||
* Some tools which don't fit somewhere else and are used everywhere are put into a [[Support Library|support_library.html]]
|
||||
|
||||
!Coding Structures
|
||||
|
|
@ -819,9 +831,8 @@ next we should //start thinking// on how to organize several aspects of the prac
|
|||
* how to organize the executable to be built?
|
||||
* what coding conventions to prefer? &rarr; [[GNU Style|DesignDocumentation]]
|
||||
* what [[build system|BuildSystem]] to use?
|
||||
|
||||
Ichthyo thinks we should do some informal brainstorming, test/prototypes to see how things work out and discuss them; then we should make them into formal project proposals on pipapo.org
|
||||
</pre>
|
||||
* various [[build dependencies|BuildDependenceis]]
|
||||
* TestSuite</pre>
|
||||
</div>
|
||||
<div title="DefaultTiddlers" modifier="CehTeh" modified="200707111115" created="200706172308" changecount="3">
|
||||
<pre>Cinelerra3Wiki
|
||||
|
|
@ -920,12 +931,12 @@ these two commands are used by 'admin/git-hooks/post-commit'
|
|||
|
||||
'git publish' just sends the commit to some repository which has to be registered with 'git remote add public ...', in case you are working offline this will stuck and timeout, you may break it with ctrl-c, someone may fix it.</pre>
|
||||
</div>
|
||||
<div title="GitBranches" modifier="Ichthyostega" modified="200708051534" created="200706260447" tags="overview git organization" changecount="11">
|
||||
<div title="GitBranches" modifier="Ichthyostega" modified="200708120100" created="200706260447" tags="overview git organization" changecount="13">
|
||||
<pre>some ''interesting Branches''
|
||||
|
||||
|![[pipapo.org|PipapoOrg]] |!''mirrored'' |!|!description |
|
||||
| ct#master | ichthyo#master | |Cinelerra3 main development line |
|
||||
| ichthyo#prototype | | |first coding attempts ;-) |
|
||||
| ichthyo#scons | | |[[SCons]]-based build system, improvements|
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
|
|
@ -1329,12 +1340,12 @@ We are in need of a new development model which is acceptable by all involved pe
|
|||
# ''All for Cinelerra''<<br>>The goal is to make the best Linux video editor to date, nothing less. Everyone puts in their best abilities. This project is not the place to blame people for things where they are not profound, help each other, make things right instead of blaming someone. Everyone should rate himself at what he can do best on the project.
|
||||
</pre>
|
||||
</div>
|
||||
<div title="MarkupPreHead" modifier="Ichthyostega" modified="200706260507" created="200706172303" tags="excludeMissing" changecount="1">
|
||||
<div title="MarkupPreHead" modifier="Ichthyostega" modified="200708120049" created="200706172303" tags="excludeMissing" changecount="2">
|
||||
<pre><!--{{{-->
|
||||
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml'/>
|
||||
<!--}}}-->
|
||||
|
||||
<style type="text/css">#contentWrapper {display:none;}</style><div id="SplashScreen" style="border: 3px solid #ccc; display: block; text-align: center; width: 320px; margin: 100px auto; padding: 50px; color:#000; font-size: 28px; font-family:Tahoma; background-color:#eee;"><b>My TiddlyWiki</b> is loading<blink> ...</blink><br><br><span style="font-size: 14px; color:red;">Requires Javascript.</span></div></pre>
|
||||
<style type="text/css">#contentWrapper {display:none;}</style><div id="SplashScreen" style="border: 3px solid #ccc; display: block; text-align: center; width: 320px; margin: 100px auto; padding: 50px; color:#000; font-size: 28px; font-family:Tahoma; background-color:#eee;"><b>Cinelerra TiddlyWiki</b> is loading<blink> ...</blink><br><br><span style="font-size: 14px; color:red;">Requires Javascript.</span></div></pre>
|
||||
</div>
|
||||
<div title="Micro-GPG-HowTo" modifier="CehTeh" modified="200708101901" created="200708101900" changecount="2">
|
||||
<pre>I (cehteh) just paste my configs and give very few hints here, refer to the gpg manpage, the gpg documentation, google or ask on IRC for details. Maybe you improve this.
|
||||
|
|
@ -3429,6 +3440,40 @@ Portions written by Luke Blanshard are hereby released into the public domain.
|
|||
<!--}}}-->
|
||||
</pre>
|
||||
</div>
|
||||
<div title="TestFacility" modifier="Ichthyostega" modified="200708120257" created="200708120134" tags="buildsys organization howto" changecount="3">
|
||||
<pre>We use a very simple test facility written by Cehteh as a bash script {{{tests/test.sh}}}
|
||||
Basically the target __tests__ of the build system uses the test code found in the tree below {{{./tests}}} to build some test binaries (btw scripts could be used too),
|
||||
and then runs {{{test.sh}}} with the testsuite definitions.
|
||||
|
||||
''Test definitions'' are defined in files {{{000foo.test, 010bar.test, ...}}}.
|
||||
Syntax is as following //(note that this are just bash scripts)//
|
||||
{{{
|
||||
TESTING "label for sometestprogram" ./sometestprogram
|
||||
|
||||
TEST "unique annotatinon" --command --line --options <<END
|
||||
expected
|
||||
output
|
||||
here
|
||||
END
|
||||
}}}
|
||||
The {{{TESTING}}} function defines {{{$TESTBIN}}} for the subsequent tests.
|
||||
the {{{TEST}}} function will run {{{"$TESTBIN --command --line --options"}}} probably under Valgrind supervision and diff its output against expected output literally specified in the test definition (e.g. {{{"expected\noutput\nhere"}}}). Note that Valgrind (used in quiet mode) produces bug reports which will make the test fail, as any other unexpected output will do.
|
||||
|
||||
------
|
||||
how to organize the actual Tests into various Test collections &rarr; see [[TestSuite]]
|
||||
</pre>
|
||||
</div>
|
||||
<div title="TestSuite" modifier="Ichthyostega" modified="200708120257" created="200708120254" tags="buildsys organization testsuite" changecount="2">
|
||||
<pre>For running the automatic Tests, we use Cehteh's simple [[test.sh|TestFacility]].
|
||||
|
||||
This page is a proposal (by Ichthyo) how the various tests could be organized.
|
||||
* individual Tests are classes, doing whatsoever and however they see fit.
|
||||
* it is up to the individual test classes to take care / handle / isolate themself form any dependencies (similar to the [[philosophy of TestNG|http://www.beust.com/weblog/archives/000082.html]])
|
||||
* for each Testsuite (=distinct collection of tests) we build an executable linked against the test class objects
|
||||
* when we get several Testsuites at some point in the future, we may consider building a shared lib of the test objects.
|
||||
* the Testsuite executable should provide some command line magic to select individual tests
|
||||
</pre>
|
||||
</div>
|
||||
<div title="TextAreaPlugin" modifier="Jeremy" created="200601261745" tags="systemConfig" server.type="file" server.host="file:///home/ct/.homepage/home.html" server.page.revision="200601261745">
|
||||
<pre>/***
|
||||
''TextAreaPlugin for TiddlyWiki version 2.0''
|
||||
|
|
@ -3556,10 +3601,12 @@ function addKeyDownHandlers(e)
|
|||
}
|
||||
//}}}</pre>
|
||||
</div>
|
||||
<div title="TiddlyWiki" modifier="Ichthyostega" created="200706260506" tags="excludeMissing" changecount="2">
|
||||
<div title="TiddlyWiki" modifier="Ichthyostega" modified="200708120058" created="200706260506" tags="excludeMissing" changecount="4">
|
||||
<pre>The Name of the Software driving this Wiki. Is is written completely in ~JavaScript and contained in one single HTML page.
|
||||
Thus no server and no network connection is needed. Simply open the file in your browser and save changes locally. As the wiki HTML is located in the Cinelerra source tree, all changes will be managed and distributed via [[GIT|GitNotes]]. While doing so, you sometimes will have to merge conflicing changes manually in the HTML source. There is a 'empty.html' in the same folder serving as template for generating new wikis. Please refrain from editing it.
|
||||
* see GettingStarted
|
||||
* see [[Homepage|http://tiddlywiki.com]]</pre>
|
||||
* see [[Homepage|http://tiddlywiki.com]], [[Wiki-Markup|http://tiddlywiki.com/#MainFeatures]]
|
||||
</pre>
|
||||
</div>
|
||||
<div title="whatInBOUML" modifier="Ichthyostega" modified="200708051535" created="200706260559" tags="discuss policy" changecount="3">
|
||||
<pre>The question to find out about is: how much of the coding to do with the help of BOUML. Basically, BOUML is capable to permanently support the coding; you can define all entities, fields and methods in the UML model an just develop the method bodies //conventionally// with a text editor.
|
||||
|
|
|
|||
|
|
@ -1232,7 +1232,7 @@ config.formatters.push( {
|
|||
} )
|
||||
//}}}</pre>
|
||||
</div>
|
||||
<div title="InterfaceNamespaces" modifier="Ichthyostega" modified="200708081455" created="200708080338" tags="impl decision discuss" changecount="13">
|
||||
<div title="InterfaceNamespaces" modifier="Ichthyostega" modified="200708120302" created="200708080338" tags="impl decision discuss" changecount="15">
|
||||
<pre>Because we rely on strong decoupling and separation into self contained components, there is not much need for a common quasi-global namespace. Operations needing the cooperation of another subsystem will be delegated or even dispatched, consequently implementation code needs only the service acces points from "direct cooperation partner" subsystems. Hierarchical scopes besides classes are needed only when multiple subsystems share a set of common abstractions. Interface and Implementation use separate namespaces.
|
||||
|
||||
!common definitions
|
||||
|
|
@ -1249,6 +1249,8 @@ These large scale interfaces reside in special namespaces "~XXX_interface&q
|
|||
!contract checks and test code
|
||||
From experiences with other middle scale projects, I prefer having the test code in a separate tree (because test code easily doubles the number of source files). But of course it should be placed into the same namespace as the code being checked, or (better?) into a nested namespace "test". It is esp. desirable to have good coverage on the contracts of the subsystem interfaces and mayor components (while it is not always feasible or advisable to cover every implementation detail).
|
||||
|
||||
&rarr; see also [[testsuite documentation in the main wiki|index.html#TestSuite]]
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
<div title="InterfacesSession" modifier="Ichthyostega" modified="200708081535" created="200708080639" changecount="7">
|
||||
|
|
|
|||
Loading…
Reference in a new issue