From 16929214fd139c9d092f9bfbd9d8287d5903f593 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Wed, 23 Dec 2020 08:04:52 -0800 Subject: [PATCH] libcody: Remove testsuite [PR 98318] libcody's testsuite is not very portable, and is testing a host library, so will do weird things on cross compiling, I think. Let's just drop it. libcody/ * Makefile.in (LDFLAGS): Drop -L.. * tests/01-serialize/connect.cc: Delete. * tests/01-serialize/decoder.cc: Delete. * tests/01-serialize/encoder.cc: Delete. * tests/02-comms/client-1.cc: Delete. * tests/02-comms/pivot-1.cc: Delete. * tests/02-comms/server-1.cc: Delete. * tests/Makesub.in: Delete. * tests/jouster: Delete. --- libcody/Makefile.in | 2 +- libcody/tests/01-serialize/connect.cc | 30 --------- libcody/tests/01-serialize/decoder.cc | 73 -------------------- libcody/tests/01-serialize/encoder.cc | 48 ------------- libcody/tests/02-comms/client-1.cc | 97 --------------------------- libcody/tests/02-comms/pivot-1.cc | 76 --------------------- libcody/tests/02-comms/server-1.cc | 68 ------------------- libcody/tests/Makesub.in | 36 ---------- libcody/tests/jouster | 11 --- 9 files changed, 1 insertion(+), 440 deletions(-) delete mode 100644 libcody/tests/01-serialize/connect.cc delete mode 100644 libcody/tests/01-serialize/decoder.cc delete mode 100644 libcody/tests/01-serialize/encoder.cc delete mode 100644 libcody/tests/02-comms/client-1.cc delete mode 100644 libcody/tests/02-comms/pivot-1.cc delete mode 100644 libcody/tests/02-comms/server-1.cc delete mode 100644 libcody/tests/Makesub.in delete mode 100755 libcody/tests/jouster diff --git a/libcody/Makefile.in b/libcody/Makefile.in index a0722f9a385..6e38d51516f 100644 --- a/libcody/Makefile.in +++ b/libcody/Makefile.in @@ -100,7 +100,7 @@ endif CXXOPTS += $(filter-out -DHAVE_CONFIG_H,@DEFS@) -include config.h # Linker options -LDFLAGS := -L. @LDFLAGS@ +LDFLAGS := @LDFLAGS@ LIBS := @LIBS@ # Per-source & per-directory compile flags (warning: recursive) diff --git a/libcody/tests/01-serialize/connect.cc b/libcody/tests/01-serialize/connect.cc deleted file mode 100644 index 85277c844af..00000000000 --- a/libcody/tests/01-serialize/connect.cc +++ /dev/null @@ -1,30 +0,0 @@ - -// Test client connection handshake -// RUN: < - -using namespace Cody; - -int main (int, char *[]) -{ - Client client (0, 1); - - auto token = client.Connect ("TEST", "IDENT"); - - std::cerr << "Code:" << token.GetCode () << '\n'; - std::cerr << "Version:" << token.GetInteger () << '\n'; -} diff --git a/libcody/tests/01-serialize/decoder.cc b/libcody/tests/01-serialize/decoder.cc deleted file mode 100644 index a3495d145da..00000000000 --- a/libcody/tests/01-serialize/decoder.cc +++ /dev/null @@ -1,73 +0,0 @@ -// CODYlib -*- mode:c++ -*- -// Copyright (C) 2020 Nathan Sidwell, nathan@acm.org -// License: Apache v2.0 - -// RUN: < -// C -#include - -using namespace Cody; - -int main (int, char *[]) -{ - Detail::MessageBuffer reader; - - reader.PrepareToRead (); - while (int e = reader.Read (0)) - if (e != EAGAIN && e != EINTR) - break; - - std::vector words; - for (unsigned line = 0; !reader.IsAtEnd (); line++) - { - if (int e = reader.Lex (words)) - std::cerr << "error:" << strerror (e) << '\n'; - for (unsigned ix = 0; ix != words.size (); ix++) - { - auto &word = words[ix]; - - std::cerr << "line:" << line << " word:" << ix - << " '" << word << "'\n"; - } - } - return 0; -} diff --git a/libcody/tests/01-serialize/encoder.cc b/libcody/tests/01-serialize/encoder.cc deleted file mode 100644 index c4cab6c630f..00000000000 --- a/libcody/tests/01-serialize/encoder.cc +++ /dev/null @@ -1,48 +0,0 @@ -// CODYlib -*- mode:c++ -*- -// Copyright (C) 2020 Nathan Sidwell, nathan@acm.org -// License: Apache v2.0 - -// Test message encoding, both string quoting and continuation lines - -// RUN: $subdir$stem |& ezio $test -// RUN-END: -// The ¯ is utf8-encoded as c2 af -// CHECK-NEXT: ^bob 'frob dob''\n¯\\'$ -// CHECK-NEXT: ^2 ;$ -// CHECK-NEXT: ^3$ -// CHECK-NEXT: $EOF - -// Cody -#include "cody.hh" - -using namespace Cody; - -int main (int, char *[]) -{ - Detail::MessageBuffer writer; - - writer.BeginLine (); - writer.AppendWord ("bob"); - writer.AppendWord ("frob dob", true); - writer.Append ("\n\xc2\xaf\\", true); - writer.EndLine (); - - writer.PrepareToWrite (); - while (int err = writer.Write (2)) - if (err != EAGAIN && err != EINTR) - break; - - writer.BeginLine (); - writer.Append ("2", true); - writer.EndLine (); - writer.BeginLine (); - writer.Append ("3", true); - writer.EndLine (); - - writer.PrepareToWrite (); - while (int err = writer.Write (2)) - if (err != EAGAIN && err != EINTR) - break; - - return 0; -} diff --git a/libcody/tests/02-comms/client-1.cc b/libcody/tests/02-comms/client-1.cc deleted file mode 100644 index edff0ab4732..00000000000 --- a/libcody/tests/02-comms/client-1.cc +++ /dev/null @@ -1,97 +0,0 @@ - -// Test client message round tripping -/* - RUN: < - -using namespace Cody; - -int main (int, char *[]) -{ - Client client (0, 1); - - client.Cork (); - if (client.Connect ("TEST", "IDENT").GetCode () != Client::PC_CORKED) - std::cerr << "Not corked!\n"; - if (client.ModuleRepo ().GetCode () != Client::PC_CORKED) - std::cerr << "Not corked!\n"; - if (client.ModuleExport ("bar").GetCode () != Client::PC_CORKED) - std::cerr << "Not corked!\n"; - if (client.ModuleImport ("foo").GetCode () != Client::PC_CORKED) - std::cerr << "Not corked!\n"; - if (client.IncludeTranslate ("baz.frob").GetCode () != Client::PC_CORKED) - std::cerr << "Not corked!\n"; - if (client.IncludeTranslate ("./corge").GetCode () != Client::PC_CORKED) - std::cerr << "Not corked!\n"; - if (client.IncludeTranslate ("./quux").GetCode () != Client::PC_CORKED) - std::cerr << "Not corked!\n"; - if (client.ModuleCompiled ("bar").GetCode () != Client::PC_CORKED) - std::cerr << "Not corked!\n"; - - auto result = client.Uncork (); - for (auto iter = result.begin (); iter != result.end (); ++iter) - { - std::cerr << "Code:" << iter->GetCode () << '\n'; - switch (iter->GetCategory ()) - { - case Packet::INTEGER: - std::cerr << "Integer:" << iter->GetInteger () << '\n'; - break; - case Packet::STRING: - std::cerr << "String:" << iter->GetString () << '\n'; - break; - case Packet::VECTOR: - { - auto const &v = iter->GetVector (); - for (unsigned ix = 0; ix != v.size (); ix++) - std::cerr << "Vector[" << ix << "]:" << v[ix] << '\n'; - } - break; - } - } -} diff --git a/libcody/tests/02-comms/pivot-1.cc b/libcody/tests/02-comms/pivot-1.cc deleted file mode 100644 index b98c833ab27..00000000000 --- a/libcody/tests/02-comms/pivot-1.cc +++ /dev/null @@ -1,76 +0,0 @@ - -// Test resolver pivot - -// RUN:< - -using namespace Cody; - -class Handler : public Resolver -{ - virtual Handler *ConnectRequest (Server *s, unsigned , - std::string &, std::string &) - { - ErrorResponse (s, "unexpected connect call"); - return nullptr; - } -}; - -Handler handler; - -class Initial : public Resolver -{ - virtual Handler *ConnectRequest (Server *s, unsigned v, - std::string &agent, std::string &ident) - { - Resolver::ConnectRequest (s, v, agent, ident); - return &handler; - } -}; - -Initial initial; - -int main (int, char *[]) -{ - Server server (&initial, 0, 1); - - while (int e = server.Read ()) - if (e != EAGAIN && e != EINTR) - break; - - server.ProcessRequests (); - if (server.GetResolver () == &handler) - std::cerr << "resolver is handler\n"; - else if (server.GetResolver () == &initial) - std::cerr << "resolver is initial\n"; - else - std::cerr << "resolver is surprising\n"; - - server.PrepareToWrite (); - while (int e = server.Write ()) - if (e != EAGAIN && e != EINTR) - break; -} diff --git a/libcody/tests/02-comms/server-1.cc b/libcody/tests/02-comms/server-1.cc deleted file mode 100644 index 0a8694e94df..00000000000 --- a/libcody/tests/02-comms/server-1.cc +++ /dev/null @@ -1,68 +0,0 @@ - -// Test server message round tripping -/* - RUN:< - -using namespace Cody; - -int main (int, char *[]) -{ - Resolver r; - Server server (&r, 0, 1); - - while (int e = server.Read ()) - if (e != EAGAIN && e != EINTR) - break; - - server.ProcessRequests (); - if (server.GetResolver () != &r) - std::cerr << "resolver changed\n"; - server.PrepareToWrite (); - - while (int e = server.Write ()) - if (e != EAGAIN && e != EINTR) - break; -} diff --git a/libcody/tests/Makesub.in b/libcody/tests/Makesub.in deleted file mode 100644 index 329e94609ee..00000000000 --- a/libcody/tests/Makesub.in +++ /dev/null @@ -1,36 +0,0 @@ -# CODYlib -*- mode:Makefile -*- -# Copyright (C) 2019-2020 Nathan Sidwell, nathan@acm.org -# License: Apache v2.0 - -ALOY := @ALOY@ -TESTS := $(patsubst $(srcdir)/%.cc,%,\ - $(wildcard $(srcdir)/tests/*/*.cc)) -TESTDIRS = $(shell cd $(srcdir)/${$@ - echo 'testdir=$(testdir)' >>$@ - echo 'timelimit=60' >>$@ - echo 'memlimit=1' >>$@ - echo 'cpulimit=60' >>$@ - echo 'filelimit=1' >>$@ - echo 'SHELL=$(SHELL)' >>$@ - -$(TESTS): %: %.o libcody.a - $(CXX) $(LDFLAGS) $< -lcody $(LIBS) -o $@ - -clean:: - rm -f $(TESTS) - rm -f $(TESTS:=.o) $(TESTS:=.d) - -ifeq ($(filter clean%,$(MAKECMDGOALS)),) --include $(TESTS:=.d) -endif diff --git a/libcody/tests/jouster b/libcody/tests/jouster deleted file mode 100755 index c7a913c8a19..00000000000 --- a/libcody/tests/jouster +++ /dev/null @@ -1,11 +0,0 @@ -#! /bin/zsh -# CODYlib -*- mode:Makefile -*- -# Copyright (C) 2019-2020 Nathan Sidwell, nathan@acm.org -# License Apache v2.0 - -pushd ${0%/*} -setopt nullglob -for subdir in $@ ; do - echo $subdir/*(.^*) -done -popd -- 2.30.2