Skip to content

Commit

Permalink
add a test to process test suite
Browse files Browse the repository at this point in the history
not that there’s a point in this test really
  • Loading branch information
CamJN committed Sep 22, 2024
1 parent df6f2ac commit 187b804
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion test/cxx/Core/ApplicationPool/ProcessTest.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <TestSupport.h>
#include <Core/ApplicationPool/Process.h>
#include <Core/ApplicationPool/Group.h>
#include <LoggingKit/Context.h>
#include <FileTools/FileManip.h>

Expand All @@ -14,6 +15,7 @@ namespace tut {
SpawningKit::Context skContext;
Context context;
BasicGroupInfo groupInfo;
unsigned int generation;
vector<SpawningKit::Result::Socket> sockets;
Pipe stdinFd, stdoutAndErrFd;
FileDescriptor server1, server2, server3;
Expand All @@ -34,6 +36,8 @@ namespace tut {
groupInfo.group = NULL;
groupInfo.name = "test";

generation = 0;

struct sockaddr_in addr;
socklen_t len = sizeof(addr);
SpawningKit::Result::Socket socket;
Expand Down Expand Up @@ -119,7 +123,7 @@ namespace tut {
args["spawner_creation_time"] = 0;

Process *p = context.processObjectPool.malloc();
p = new (p) Process(&groupInfo, 0, result, args);
p = new (p) Process(&groupInfo, generation, result, args);
ProcessPtr process(p, false);

process->shutdownNotRequired();
Expand Down Expand Up @@ -240,4 +244,15 @@ namespace tut {
&& contents.find("stdout and err 4\n") != string::npos;
);
}

TEST_METHOD(6) {
set_test_name("Test generation is inherited from pool at construction time");
// this test is pointless b/c the process is made at line 123 of this file, not in the regular codebase
ProcessPtr process1 = createProcess();
ensure_equals(process1->generation, generation);
generation++;
ProcessPtr process2 = createProcess();
ensure_equals(process2->generation, generation);
ensure(process1->generation != process2->generation);
}
}

0 comments on commit 187b804

Please sign in to comment.