Browse Source

Remove old unit test program

master
Jacob Bachmeyer 3 years ago
parent
commit
93b2a2bafe
  1. 9
      ChangeLog
  2. 3
      Makefile.am
  3. 36
      Makefile.in
  4. 24
      testsuite/libdejagnu/tunit.exp
  5. 139
      testsuite/libdejagnu/unit.cc

9
ChangeLog

@ -1,5 +1,14 @@
2022-11-29 Jacob Bachmeyer <jcb@gnu.org>
* Makefile.in: Regenerate.
* Makefile.am (check_PROGRAMS): Remove unit.
(unit_SOURCES): Remove.
* testsuite/libdejagnu/tunit.exp: Remove file.
* testsuite/libdejagnu/unit.cc: Remove file.
The limited coverage of this test is now included in unit.exp
and unit-cxx, and supporting this test required some leaky
abstractions in dejagnu.h that can now be cleaned up.
* Makefile.in: Regenerate.
* Makefile.am (check_PROGRAMS): Add testsuite/libdejagnu/unit-cxx.
(testsuite_libdejagnu_unit_cxx_SOURCES): Add.

3
Makefile.am

@ -230,10 +230,9 @@ DEJATOOL = launcher libdejagnu report-card runtest
RUNTEST = ${top_srcdir}/runtest
AM_CPPFLAGS = -I$(top_srcdir)
check_PROGRAMS = unit \
check_PROGRAMS = \
testsuite/libdejagnu/unit-c \
testsuite/libdejagnu/unit-cxx
unit_SOURCES = testsuite/libdejagnu/unit.cc
testsuite_libdejagnu_unit_c_SOURCES = testsuite/libdejagnu/unit-c.c
testsuite_libdejagnu_unit_cxx_SOURCES = testsuite/libdejagnu/unit-cxx.cxx

36
Makefile.in

@ -108,7 +108,7 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
check_PROGRAMS = unit$(EXEEXT) testsuite/libdejagnu/unit-c$(EXEEXT) \
check_PROGRAMS = testsuite/libdejagnu/unit-c$(EXEEXT) \
testsuite/libdejagnu/unit-cxx$(EXEEXT)
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@ -134,9 +134,6 @@ am_testsuite_libdejagnu_unit_cxx_OBJECTS = \
testsuite_libdejagnu_unit_cxx_OBJECTS = \
$(am_testsuite_libdejagnu_unit_cxx_OBJECTS)
testsuite_libdejagnu_unit_cxx_LDADD = $(LDADD)
am_unit_OBJECTS = testsuite/libdejagnu/unit.$(OBJEXT)
unit_OBJECTS = $(am_unit_OBJECTS)
unit_LDADD = $(LDADD)
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@ -212,9 +209,9 @@ am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
am__v_CXXLD_0 = @echo " CXXLD " $@;
am__v_CXXLD_1 =
SOURCES = $(testsuite_libdejagnu_unit_c_SOURCES) \
$(testsuite_libdejagnu_unit_cxx_SOURCES) $(unit_SOURCES)
$(testsuite_libdejagnu_unit_cxx_SOURCES)
DIST_SOURCES = $(testsuite_libdejagnu_unit_c_SOURCES) \
$(testsuite_libdejagnu_unit_cxx_SOURCES) $(unit_SOURCES)
$(testsuite_libdejagnu_unit_cxx_SOURCES)
AM_V_DVIPS = $(am__v_DVIPS_@AM_V@)
am__v_DVIPS_ = $(am__v_DVIPS_@AM_DEFAULT_V@)
am__v_DVIPS_0 = @echo " DVIPS " $@;
@ -594,7 +591,6 @@ DEJATOOL = launcher libdejagnu report-card runtest
# of DejaGnu instead of an installed version.
RUNTEST = ${top_srcdir}/runtest
AM_CPPFLAGS = -I$(top_srcdir)
unit_SOURCES = testsuite/libdejagnu/unit.cc
testsuite_libdejagnu_unit_c_SOURCES = testsuite/libdejagnu/unit-c.c
testsuite_libdejagnu_unit_cxx_SOURCES = testsuite/libdejagnu/unit-cxx.cxx
@ -610,7 +606,7 @@ doc_dejagnu_TEXINFOS = doc/fdl.texi
all: all-am
.SUFFIXES:
.SUFFIXES: .c .cc .cxx .dvi .o .obj .ps
.SUFFIXES: .c .cxx .dvi .o .obj .ps
am--refresh: Makefile
@:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@ -667,13 +663,6 @@ testsuite/libdejagnu/unit-cxx.$(OBJEXT): \
testsuite/libdejagnu/unit-cxx$(EXEEXT): $(testsuite_libdejagnu_unit_cxx_OBJECTS) $(testsuite_libdejagnu_unit_cxx_DEPENDENCIES) $(EXTRA_testsuite_libdejagnu_unit_cxx_DEPENDENCIES) testsuite/libdejagnu/$(am__dirstamp)
@rm -f testsuite/libdejagnu/unit-cxx$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(testsuite_libdejagnu_unit_cxx_OBJECTS) $(testsuite_libdejagnu_unit_cxx_LDADD) $(LIBS)
testsuite/libdejagnu/unit.$(OBJEXT): \
testsuite/libdejagnu/$(am__dirstamp) \
testsuite/libdejagnu/$(DEPDIR)/$(am__dirstamp)
unit$(EXEEXT): $(unit_OBJECTS) $(unit_DEPENDENCIES) $(EXTRA_unit_DEPENDENCIES)
@rm -f unit$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(unit_OBJECTS) $(unit_LDADD) $(LIBS)
install-binSCRIPTS: $(bin_SCRIPTS)
@$(NORMAL_INSTALL)
@list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
@ -754,7 +743,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@testsuite/libdejagnu/$(DEPDIR)/unit-c.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@testsuite/libdejagnu/$(DEPDIR)/unit-cxx.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@testsuite/libdejagnu/$(DEPDIR)/unit.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@ -772,22 +760,6 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cc.o:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
.cc.obj:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cxx.o:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\

24
testsuite/libdejagnu/tunit.exp

@ -1,24 +0,0 @@
# Copyright (C) 1992-2016 Free Software Foundation, Inc.
#
# This file is part of DejaGnu.
#
# DejaGnu 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 3 of the License, or
# (at your option) any later version.
#
# DejaGnu 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 DejaGnu; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
load_lib "dejagnu.exp"
# Execute the test case, and analyse the output
if { [host_execute "unit"] ne "" } {
perror "unit had an execution error" 0
}

139
testsuite/libdejagnu/unit.cc

@ -1,139 +0,0 @@
// unit.cc -- This is a test case for the dejagnu.h classes.
// Copyright (C) 2001-2016 Free Software Foundation, Inc.
// This file is part of DejaGnu.
// DejaGnu 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 3 of the License, or
// (at your option) any later version.
// DejaGnu 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 DejaGnu; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#include <sys/types.h>
#include <iostream>
#include <regex.h>
#include <string>
#include <fstream>
#include <sstream>
#include <set>
#include <dejagnu.h>
using namespace std;
TestState runtest;
TestState test;
class TestClass1
{
public:
string tname;
unsigned int tnum;
};
TestClass1 testClass1, testClass2, testClass3;
TestClass1 *testClassPtr;
// We have to do this silly crap with renaming the output string, so
// the generic Tcl code that looks for the output state gets confused,
// and records random duplicate messages.
const char *os1[] = {
"FAI: ", "PAS: ", "UNT: ", "UNR: "
};
const char *os2[] = {
"FAILED: ", "PASSED: ", "UNTESTED: ", "UNRESOLVED: "
};
int
main (int argc, char *argv[])
{
regex_t regex_pat;
outstate = os1;
stringstream strbuf;
streambuf *pbuf;
// Replace the output buffer for cout, so we can examine it to see
// what was displayed. Otherwise, there is no way we can test the
// logging functions completely.
pbuf = cout.rdbuf ();
testClass1.tname = "testType1";
testClass1.tnum = 1;
testClass2.tname = "testType2";
testClass2.tnum = 2;
testClass3.tname = "testType3";
testClass3.tnum = 3;
// Test the pass message.
cout.rdbuf (strbuf.rdbuf ());
strbuf.str ("");
test.pass ("bogus pass message for testing");
outstate = os2;
cout.rdbuf (pbuf);
if (strncmp (strbuf.str().c_str(), "\tPAS: bogus pass message", 22) == 0)
runtest.pass ("Pass message");
else
runtest.fail ("Pass message");
// Test the fail message.
cout.rdbuf (strbuf.rdbuf ());
strbuf.str ("");
outstate = os1;
test.fail ("bogus fail message for testing");
cout.rdbuf (pbuf);
outstate = os2;
if (strncmp (strbuf.str().c_str(), "\tFAI: bogus fail message", 22) == 0)
runtest.pass ("Fail message");
else
runtest.fail ("Fail message");
// Test the untested message.
cout.rdbuf (strbuf.rdbuf ());
strbuf.str ("");
outstate = os1;
test.untested ("bogus untested message for testing");
cout.rdbuf (pbuf);
outstate = os2;
if (strncmp (strbuf.str().c_str(), "\tUNT: bogus untested message", 21) == 0) {
runtest.pass ("Untested message");
} else {
runtest.fail ("Untested message");
}
// Test the unresolved message.
cout.rdbuf (strbuf.rdbuf ());
strbuf.str ("");
outstate = os1;
test.unresolved ("bogus unresolved message for testing");
cout.rdbuf (pbuf);
outstate = os2;
if (strncmp (strbuf.str().c_str(), "\tUNR: bogus unresolved message", 21) == 0)
runtest.pass ("Unresolved message");
else
runtest.fail ("Unresolved message");
// Make sure we got everything in the totals.
cout.rdbuf (strbuf.rdbuf ());
strbuf.str ("");
regcomp (&regex_pat,
"\t#passed.*#real failed.*#untested.*#unresolved",
REG_NOSUB);
test.totals ();
cout.rdbuf (pbuf);
if (regexec (&regex_pat, strbuf.str().c_str(), 0, (regmatch_t *) 0, 0) == 0)
runtest.pass ("Totals message");
else
runtest.fail ("Totals message");
return 0;
}
Loading…
Cancel
Save