Browse Source

tests: create subdir "framework"

LIB-12
heck 4 years ago
parent
commit
07b4ee6e97
  1. 2
      src/Makefile
  2. 2
      src/adapter_group.h
  3. 19
      test/Makefile
  4. 6
      test/framework/framework.cc
  5. 4
      test/framework/framework.hh
  6. 7
      test/test_adapter.cc
  7. 6
      test/test_adapter_cxx.cc
  8. 12
      test/test_ensure_passphrase.cc
  9. 9
      test/test_leave_device_group.cc
  10. 8
      test/test_message_cache.cc
  11. 10
      test/test_passphrase_cache.cc
  12. 3
      test/test_semaphore.cc

2
src/Makefile

@ -6,7 +6,7 @@
include ../Makefile.conf include ../Makefile.conf
SOURCE=$(wildcard *.cc) SOURCE=$(wildcard *.cc)
HEADERS=$(wildcard *.hh *.hxx) HEADERS=$(wildcard *.hh *.hxx *.h)
OBJECTS=$(subst .cc,.o,$(SOURCE)) OBJECTS=$(subst .cc,.o,$(SOURCE))
DEPENDS=$(subst .cc,.d,$(SOURCE)) DEPENDS=$(subst .cc,.d,$(SOURCE))
CXXFLAGS+= -MMD -MP CXXFLAGS+= -MMD -MP

2
src/adapter_group.h

@ -4,6 +4,8 @@
#ifndef LIBPEPADAPTER_GROUP_HH #ifndef LIBPEPADAPTER_GROUP_HH
#define LIBPEPADAPTER_GROUP_HH #define LIBPEPADAPTER_GROUP_HH
#include <pEp/message_api.h>
#include <pEp/group.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

19
test/Makefile

@ -3,17 +3,24 @@ include ../Makefile.conf
LDFLAGS=-L../src $(ENGINE_LIB) LDFLAGS=-L../src $(ENGINE_LIB)
LDLIBS=-lstdc++ -lpEpEngine -lpEpAdapter LDLIBS=-lstdc++ -lpEpEngine -lpEpAdapter
CXXFLAGS:=-I../src -DENGINE_TEST=$(ENGINE_TEST) $(CXXFLAGS) CXXFLAGS:=-I../src -DENGINE_TEST=$(ENGINE_TEST) $(CXXFLAGS)
SRC=$(wildcard test_*.cc)
TST=$(subst .cc,,$(SRC))
all: $(TST) SRC_TEST=$(wildcard test_*.cc)
BIN_TEST=$(subst .cc,,$(SRC_TEST))
$(TST): framework.o SRC_FRAMEWORK=$(wildcard framework/*.cc)
OBJ_FRAMEWORK=$(subst .cc,.o,$(SRC_FRAMEWORK))
.PHONY: all clean rmtestdata
all: $(BIN_TEST)
$(BIN_TEST): $(OBJ_FRAMEWORK)
.PHONY: clean rmtestdata
clean: clean:
rm -f $(TST) rm -f $(BIN_TEST)
rm -f $(OBJ_FRAMEWORK)
rm -Rf *.dSYM rm -Rf *.dSYM
rm -f *.o rm -f *.o
rm -Rf /tmp/test_pEp.* rm -Rf /tmp/test_pEp.*

6
test/framework.cc → test/framework/framework.cc

@ -8,7 +8,6 @@
#include <utility> #include <utility>
#include <exception> #include <exception>
#include <thread> #include <thread>
#include <unistd.h> #include <unistd.h>
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
@ -22,7 +21,7 @@
#include <pEp/sync_codec.h> #include <pEp/sync_codec.h>
#include <pEp/distribution_codec.h> #include <pEp/distribution_codec.h>
#include <Adapter.hh> #include "../src/Adapter.hh"
pEp::Test::Transport pEp::Test::transport; pEp::Test::Transport pEp::Test::transport;
std::string pEp::Test::path; std::string pEp::Test::path;
@ -74,8 +73,9 @@ namespace pEp {
void setup(int argc, char **argv) void setup(int argc, char **argv)
{ {
vector<string> args{ (size_t)argc }; vector<string> args{ (size_t)argc };
for (int i = 0; i < argc; ++i) for (int i = 0; i < argc; ++i) {
args[i] = argv[i]; args[i] = argv[i];
}
setup(args); setup(args);
} }

4
test/framework.hh → test/framework/framework.hh

@ -10,10 +10,10 @@
#include <pEp/message.h> #include <pEp/message.h>
using namespace std;
namespace pEp { namespace pEp {
namespace Test { namespace Test {
using namespace std;
// manually set up test // manually set up test
void setup(vector<string> &args); void setup(vector<string> &args);

7
test/test_adapter.cc

@ -1,18 +1,19 @@
// This file is under GNU General Public License 3.0 // This file is under GNU General Public License 3.0
// see LICENSE.txt // see LICENSE.txt
#include "framework.hh" #include "framework/framework.hh"
#include <iostream> #include <iostream>
#include <assert.h> #include <assert.h>
#include <unistd.h> #include <unistd.h>
#include <sys/param.h> #include <sys/param.h>
#include <pEpLog.hh>
#include <Adapter.hh>
#include <pEp/sync_api.h> #include <pEp/sync_api.h>
#include <pEp/keymanagement.h> #include <pEp/keymanagement.h>
#include <pEp/message_api.h> #include <pEp/message_api.h>
#include "../src/pEpLog.hh"
#include "../src/Adapter.hh"
using namespace std; using namespace std;
using namespace pEp; using namespace pEp;

6
test/test_adapter_cxx.cc

@ -1,16 +1,16 @@
// This file is under GNU General Public License 3.0 // This file is under GNU General Public License 3.0
// see LICENSE.txt // see LICENSE.txt
#include "framework.hh" #include "framework/framework.hh"
#include <iostream> #include <iostream>
#include <assert.h> #include <assert.h>
#include <unistd.h> #include <unistd.h>
#include <pEp/keymanagement.h> #include <pEp/keymanagement.h>
#include <pEpLog.hh>
#include <pEp/sync_api.h> #include <pEp/sync_api.h>
#include <Adapter.hh> #include "../src/Adapter.hh"
#include "../src/pEpLog.hh"
using namespace pEp; using namespace pEp;

12
test/test_ensure_passphrase.cc

@ -1,6 +1,8 @@
// This file is under GNU General Public License 3.0 // This file is under GNU General Public License 3.0
// see LICENSE.txt // see LICENSE.txt
#include "framework/framework.hh"
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
@ -10,16 +12,14 @@
#include <string.h> #include <string.h>
#include <sys/param.h> #include <sys/param.h>
#include "framework.hh"
#include <passphrase_cache.hh>
#include <status_to_string.hh>
#include <Adapter.hh>
#include <pEp/message_api.h> #include <pEp/message_api.h>
#include <pEp/keymanagement.h> #include <pEp/keymanagement.h>
#include <pEp/key_reset.h> #include <pEp/key_reset.h>
#include "../src/passphrase_cache.hh"
#include "../src/status_to_string.hh"
#include "../src/Adapter.hh"
using namespace pEp; using namespace pEp;
using namespace std; using namespace std;

9
test/test_leave_device_group.cc

@ -1,16 +1,17 @@
// This file is under GNU General Public License 3.0 // This file is under GNU General Public License 3.0
// see LICENSE.txt // see LICENSE.txt
#include "framework/framework.hh"
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <unistd.h> #include <unistd.h>
#include "framework.hh"
#include <passphrase_cache.hh>
#include <callback_dispatcher.hh>
#include <pEp/sync_api.h> #include <pEp/sync_api.h>
#include "../src/callback_dispatcher.hh"
#include "../src/passphrase_cache.hh"
using namespace std; using namespace std;
using namespace pEp; using namespace pEp;

8
test/test_message_cache.cc

@ -1,13 +1,15 @@
// This file is under GNU General Public License 3.0 // This file is under GNU General Public License 3.0
// see LICENSE.txt // see LICENSE.txt
#include "framework.hh" #include "framework/framework.hh"
#include <iostream> #include <iostream>
#include <cassert> #include <cassert>
#include <sys/param.h> #include <sys/param.h>
#include <unistd.h> #include <unistd.h>
#include <message_cache.hh>
#include <Adapter.hh> #include "../src/message_cache.hh"
#include "../src/Adapter.hh"
using namespace std; using namespace std;
using namespace pEp; using namespace pEp;

10
test/test_passphrase_cache.cc

@ -1,16 +1,16 @@
// This file is under GNU General Public License 3.0 // This file is under GNU General Public License 3.0
// see LICENSE.txt // see LICENSE.txt
#include "framework.hh" #include "framework/framework.hh"
#include <iostream> #include <iostream>
#include <unistd.h> #include <unistd.h>
#include <assert.h> #include <assert.h>
#include <sys/param.h> #include <sys/param.h>
#include <passphrase_cache.hh>
#include <status_to_string.hh> #include "../src/passphrase_cache.hh"
#include <Adapter.hh> #include "../src/status_to_string.hh"
#include "../src/Adapter.hh"
using namespace pEp; using namespace pEp;

3
test/test_semaphore.cc

@ -4,7 +4,8 @@
#include <iostream> #include <iostream>
#include <thread> #include <thread>
#include <unistd.h> #include <unistd.h>
#include "Semaphore.hh"
#include "../src/Semaphore.hh"
using namespace std; using namespace std;
using namespace pEp; using namespace pEp;

Loading…
Cancel
Save