Skip to content
Snippets Groups Projects
Commit d7455cc8 authored by Marcel Loose's avatar Marcel Loose :sunglasses:
Browse files

Bug 1310: Move of directory MAC/Test/Suite to MAC/APL/TestSuite (part one)

parent 873d4f1c
No related branches found
No related tags found
No related merge requests found
...@@ -358,6 +358,10 @@ MAC/APL/StationCU/src/HardwareMonitor/TBBMonitor.cc -text ...@@ -358,6 +358,10 @@ MAC/APL/StationCU/src/HardwareMonitor/TBBMonitor.cc -text
MAC/APL/StationCU/src/HardwareMonitor/TBBMonitor.h -text MAC/APL/StationCU/src/HardwareMonitor/TBBMonitor.h -text
MAC/APL/StationCU/src/TBBControl/TBBObservation.cc -text MAC/APL/StationCU/src/TBBControl/TBBObservation.cc -text
MAC/APL/StationCU/src/TBBControl/TBBObservation.h -text MAC/APL/StationCU/src/TBBControl/TBBObservation.h -text
MAC/APL/TestSuite/Makefile.am -text svneol=native#application/octet-stream
MAC/APL/TestSuite/bootstrap -text svneol=native#application/octet-stream
MAC/APL/TestSuite/configure.in -text svneol=native#application/octet-stream
MAC/APL/TestSuite/src/Makefile.am -text svneol=native#application/octet-stream
MAC/APL/lofarconf.in -text svneol=native#application/octet-stream MAC/APL/lofarconf.in -text svneol=native#application/octet-stream
MAC/Config/Apc/b1.apc -text svneol=native#application/octet-stream MAC/Config/Apc/b1.apc -text svneol=native#application/octet-stream
MAC/Config/Apc/b2.apc -text svneol=native#application/octet-stream MAC/Config/Apc/b2.apc -text svneol=native#application/octet-stream
......
...@@ -165,6 +165,9 @@ MAC/APL/StsMisc/lofarconf ...@@ -165,6 +165,9 @@ MAC/APL/StsMisc/lofarconf
MAC/APL/TestCtlr/Makefile.common MAC/APL/TestCtlr/Makefile.common
MAC/APL/TestCtlr/autoconf_share MAC/APL/TestCtlr/autoconf_share
MAC/APL/TestCtlr/lofarconf MAC/APL/TestCtlr/lofarconf
MAC/APL/TestSuite/Makefile.common
MAC/APL/TestSuite/autoconf_share
MAC/APL/TestSuite/lofarconf
MAC/Deployment/Makefile.common MAC/Deployment/Makefile.common
MAC/Deployment/autoconf_share MAC/Deployment/autoconf_share
MAC/Deployment/lofarconf MAC/Deployment/lofarconf
......
SUBDIRS=src include
ACLOCAL_AMFLAGS = -I autoconf_share
pkgextdir = $(prefix)/config/$(PACKAGE)
pkgext_DATA = pkgext pkgextcppflags pkgextcxxflags pkgextldflags
DISTCHECK_CONFIGURE_FLAGS=\
--with-common=$(prefix)
EXTRA_DIST = \
Makefile.common \
Suite.spec \
autoconf_share/compiletool
include $(top_srcdir)/Makefile.common
# -*- Mode:rpm-spec -*-
# Suite.spec.in
#
##############################################################################
#
# Preamble
#
##############################################################################
Summary: The test Suite package contains the base classes for the test suite framework.
%define release @RPM_RELEASE@
%define version @VERSION@
%define pkgname @PACKAGE@
%define pkgdir %{pkgname}-%{version}-%{release}
%define prefix /opt/lofar
%define configure_args @RPM_CONFIGURE_ARGS@
##define build_kernel_version @BUILD_KERNEL_VERSION@
Name: %{pkgname}
Version: %{version}
Release: %{release}
Copyright: LGPL
Group: Application/System
Source: %{pkgname}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{pkgdir}-root
URL: http://www.astron.nl
Prefix: %{prefix}
BuildArchitectures: i386 # Target platforms, i.e., i586
Requires: Common >= 2.2
Packager: %{packager}
Distribution: The LOFAR project
Vendor: ASTRON
AutoReqProv: no
%description
The test Suite package contains the base classes for the test suite framework.
##############################################################################
#
# prep
#
##############################################################################
%prep
echo $prefix
# create the build directory, untar the source
%setup
##############################################################################
#
# build
#
##############################################################################
%build
./configure %{configure_args} --prefix=%{prefix} && make
##############################################################################
#
# install
#
##############################################################################
%install
# To make things work with BUILDROOT
if [ "$RPM_BUILD_ROOT" != "%{_tmppath}/%{pkgdir}-root" ]
then
echo
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo @ @
echo @ RPM_BUILD_ROOT is not what I expected. Please clean it yourself. @
echo @ @
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo
else
echo Cleaning RPM_BUILD_ROOT: "$RPM_BUILD_ROOT"
rm -rf "$RPM_BUILD_ROOT"
fi
mkdir -p $RPM_BUILD_ROOT%{prefix}
make DESTDIR="$RPM_BUILD_ROOT" install
#uninstall
##############################################################################
#
# verify
#
##############################################################################
#verify
##############################################################################
#
# clean
#
##############################################################################
%clean
# Call me paranoid, but I do not want to be responsible for nuking
# someone's harddrive!
if [ "$RPM_BUILD_ROOT" != "%{_tmppath}/%{pkgdir}-root" ]
then
echo
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo @ @
echo @ RPM_BUILD_ROOT is not what I expected. Please clean it yourself. @
echo @ @
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo
else
echo Cleaning RPM_BUILD_ROOT: "$RPM_BUILD_ROOT"
rm -rf "$RPM_BUILD_ROOT"
fi
##############################################################################
#
# files
#
##############################################################################
# empty 'files' means all distributed files
%files
%defattr(-, root, root)
%{prefix}
# Your application file list goes here
# %{prefix}/lib/lib*.so*
# Documentation
# doc COPYING ChangeLog README AUTHORS NEWS
# doc doc/*
# link the module to the correct path
%post
# before uninstall
%preun
# after uninstall
%postun
##############################################################################
#
# package devel
#
##############################################################################
#package devel
#Summary: Development files for %{pkgname}
#Group: Applications/System
#description devel
#Development files for %{pkgname}.
#files devel
# Your development files go here
# Programmers documentation goes here
#doc doc
# end of file
#!/bin/sh
../../../autoconf_share/bootstrap ../../../autoconf_share
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
AC_INIT
dnl AC_CONFIG_AUX_DIR(config)
dnl AM_CONFIG_HEADER(config/config.h)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(Suite, 1.0, no-define)
dnl Initialize for LOFAR (may set compilers)
lofar_INIT
dnl Checks for programs.
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_DISABLE_SHARED
AC_PROG_LIBTOOL
AC_PROG_YACC
AM_PROG_LEX
dnl Checks for libraries.
dnl dnl Replace `main' with a function in -lfl:
dnl AC_CHECK_LIB(fl, main)
dnl dnl Replace `main' with a function in -lcosev_r:
dnl AC_CHECK_LIB(cosev_r, main)
dnl dnl Replace `main' with a function in -lcosnm_r:
dnl AC_CHECK_LIB(cosnm_r, main)
dnl dnl Replace `main' with a function in -lorb_r:
dnl AC_CHECK_LIB(orb_r, main)
dnl dnl Replace `main' with a function in -lpthread:
dnl AC_CHECK_LIB(pthread, main)
dnl dnl Replace `main' with a function in -lvport_r:
dnl AC_CHECK_LIB(vport_r, main)
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
dnl Checks for library functions.
AC_FUNC_VPRINTF
dnl
dnl Check for LOFAR specific things
dnl
lofar_GENERAL
lofar_COMPILETOOLS
lofar_INTERNAL(LCS/Common, Common, , 1, Common/LofarTypes.h,,)
dnl
dnl Output Makefiles
dnl
AC_OUTPUT(
include/Makefile
include/TestSuite/Makefile
src/Makefile
Makefile
TestSuite.spec
)
SUBDIRS = TestSuite
include $(top_srcdir)/Makefile.common
pkgincludedir = $(includedir)/Suite
NOINSTHDRS =
INSTHDRS =
pkginclude_HEADERS = $(NOINSTHDRS) $(INSTHDRS)
DOCHDRS = $(pkginclude_HEADERS)
lib_LTLIBRARIES = libsuite.la
libaplcommon_la_CPPFLAGS= \
-I$(top_srcdir)/include \
-DBOOST_DISABLE_THREADS \
-Wno-deprecated \
-fmessage-length=0 \
-fdiagnostics-show-location=once
libsuite_la_SOURCES= Package__Version.cc $(DOCHDRS) \
suite.cpp \
test.cpp
BUILT_SOURCES =
EXTRA_DIST =
clean-local:
rm -f *.ph
bin_PROGRAMS = versionsuite
versionsuite_SOURCES = versionsuite.cc
versionsuite_LDADD = libsuite.la
versionsuite_DEPENDENCIES = libsuite.la $(LOFAR_DEPEND)
include $(top_srcdir)/Makefile.common
//# suite.cpp
//#
//# Source: C++ Users Journal - September 2000
//# Chuck Allison - The Simplest Automated Unit Test Framework That Could Possibly Work
//# Article: http://www.cuj.com/documents/s=8035/cuj0009allison1/
//# code: ftp://ftp.cuj.com/pub/2000/cujsep2000.zip
//#
//# Modifications for LOFAR:
//# - removed TestSuiteError exception
//# - removed runtime type information
//#
//# Copyright (C) 2002-2004
//# ASTRON (Netherlands Foundation for Research in Astronomy)
//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
//#
//# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//#
//# $Id$
#include <TestSuite/suite.h>
#include <Common/lofar_iostream.h>
#include <assert.h>
void Suite::addTest(Test* t)
{
// Make sure test has a stream:
if (t != 0)
{
if (m_osptr != 0 && t->getStream() == 0)
{
t->setStream(m_osptr);
}
m_tests.push_back(t);
t->reset();
}
}
void Suite::addSuite(const Suite& s)
{
for (size_t i = 0; i < s.m_tests.size(); ++i)
addTest(s.m_tests[i]);
}
void Suite::free()
{
// This is not a destructor because tests
// don't have to be on the heap.
for (size_t i = 0; i < m_tests.size(); ++i)
{
delete m_tests[i];
m_tests[i] = 0;
}
}
void Suite::run()
{
reset();
for (size_t i = 0; i < m_tests.size(); ++i)
{
assert(m_tests[i]);
m_tests[i]->run();
}
}
long Suite::report() const
{
if (m_osptr)
{
long totFail = 0;
*m_osptr << "Test suite \"" << m_name << "\"\n=======";
size_t i;
for (i = 0; i < m_name.size(); ++i)
*m_osptr << '=';
*m_osptr << "=\n";
for (i = 0; i < m_tests.size(); ++i)
{
assert(m_tests[i]);
totFail += m_tests[i]->report();
}
*m_osptr << "=======";
for (i = 0; i < m_name.size(); ++i)
*m_osptr << '=';
*m_osptr << "=\n";
return totFail;
}
else
return getNumFailed();
}
long Suite::getNumPassed() const
{
long totPass = 0;
for (size_t i = 0; i < m_tests.size(); ++i)
{
assert(m_tests[i]);
totPass += m_tests[i]->getNumPassed();
}
return totPass;
}
long Suite::getNumFailed() const
{
long totFail = 0;
for (size_t i = 0; i < m_tests.size(); ++i)
{
assert(m_tests[i]);
totFail += m_tests[i]->getNumFailed();
}
return totFail;
}
void Suite::reset()
{
for (size_t i = 0; i < m_tests.size(); ++i)
{
assert(m_tests[i]);
m_tests[i]->reset();
}
}
//# test.cpp
//#
//# Source: C++ Users Journal - September 2000
//# Chuck Allison - The Simplest Automated Unit Test Framework That Could Possibly Work
//# Article: http://www.cuj.com/documents/s=8035/cuj0009allison1/
//# code: ftp://ftp.cuj.com/pub/2000/cujsep2000.zip
//#
//# Modifications for LOFAR:
//# - removed TestSuiteError exception
//# - removed runtime type information
//#
//# Copyright (C) 2002-2004
//# ASTRON (Netherlands Foundation for Research in Astronomy)
//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
//#
//# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//#
//# $Id$
#include <lofar_config.h>
#include <TestSuite/test.h>
#include <Common/lofar_iostream.h>
#include <Common/LofarLogger.h>
#include <Common/StringUtil.h>
using std::endl;
#ifdef _MSC_VER
//Allow return-less mains:
#pragma warning(disable: 4541)
#endif
bool Test::do_test(bool cond, const std::string& lbl,
const char* descr,
const char* fname, long lineno)
{
if (!cond)
do_fail(lbl, descr, fname, lineno);
else
succeed(lbl, descr, fname, lineno);
return cond;
}
void Test::do_fail(const std::string& lbl,
const char* descr,
const char* fname, long lineno)
{
++m_nFail;
m_subTests[m_curSubTest].failed++;
string failure;
failure += "Test: (" + m_curSubTest +") ";
if (descr) failure += descr;
if (lbl.length() > 0) failure += " (" + lbl + ")";
failure += LOFAR::formatString(" => FAILED!!! [%s:%d]", (strrchr(fname, '/') + 1), lineno);
if (m_osptr)
{
*m_osptr << failure << endl;
}
m_failures.push_back(failure);
}
void Test::succeed(const std::string& lbl,
const char* descr,
const char* fname, long lineno)
{
m_subTests[m_curSubTest].passed++;
++m_nPass;
if (m_osptr)
{
*m_osptr << "Test: ";
if (descr) *m_osptr << descr;
*m_osptr << "(" << lbl << ") => succeed ["
<< (strrchr(fname, '/') + 1)
<< ":" << lineno << "]\n";
}
}
long Test::report() const
{
if (m_osptr)
{
*m_osptr << "Test summary \""
<< m_name << "\":\n"
<< "\tPassed: " << m_nPass
<< "\tFailed: " << m_nFail
<< endl << "Failures:" << endl;
for (TFailures::const_iterator iter = m_failures.begin();
iter != m_failures.end(); ++iter)
{
*m_osptr << "\t" << *iter << endl;
}
}
return m_nFail;
}
void Test::reportSubTest()
{
if (m_osptr && m_curSubTest != "")
{
*m_osptr << "Finish (sub)test "
<< m_name << "." << m_curSubTest
<< "\tPassed: " << m_subTests[m_curSubTest].passed
<< "\tFailed: " << m_subTests[m_curSubTest].failed
<< endl;
}
}
void Test::setCurSubTest(const char* testname, const char* description)
{
if (m_curSubTest != testname && m_osptr)
{
if (m_curSubTest.length() > 0)
{
*m_osptr << "Finish (sub)test "
<< m_name << "." << m_curSubTest
<< "\tPassed: " << m_subTests[m_curSubTest].passed
<< "\tFailed: " << m_subTests[m_curSubTest].failed
<< endl;
}
*m_osptr << "Start (sub)test "
<< m_name << "." << testname;
if (description) *m_osptr << ": " << description;
*m_osptr << endl;
}
m_curSubTest = testname;
TSubTests::iterator iter = m_subTests.find(m_curSubTest);
if (iter != m_subTests.end())
{
TSubTest subTest;
subTest.passed = 0;
subTest.failed = 0;
m_subTests[m_curSubTest] = subTest;
}
}
void Test::reset()
{
m_nPass = m_nFail = 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment