Skip to content

Commit 1028764

Browse files
committed
Merge pull request #629 from arstrube/mingw
Correct handling of __MinGW__ in Gcc/UtestPlatform.cpp
2 parents 158b015 + 82b405e commit 1028764

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/Platforms/Gcc/UtestPlatform.cpp

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,24 @@ static int jmp_buf_index = 0;
5555

5656
#ifdef __MINGW32__
5757

58-
static void GccNoPThreadPlatformSpecificRunTestInASeperateProcess(UtestShell* shell, TestPlugin*, TestResult* result)
58+
static void GccPlatformSpecificRunTestInASeperateProcess(UtestShell* shell, TestPlugin*, TestResult* result)
5959
{
6060
result->addFailure(TestFailure(shell, "-p doesn't work on MinGW as it is lacking fork.\b"));
6161
}
6262

63-
void (*PlatformSpecificRunTestInASeperateProcess)(UtestShell* shell, TestPlugin* plugin, TestResult* result) =
64-
GccNoPThreadPlatformSpecificRunTestInASeperateProcess;
63+
static pid_t PlatformSpecificForkImplementation(void)
64+
{
65+
return (pid_t) 0;
66+
}
67+
68+
static int PlatformSpecificWaitPidImplementation(int, int*, int)
69+
{
70+
return 0;
71+
}
6572

6673
#else
6774

68-
static void GccCygwinPlatformSpecificRunTestInASeperateProcess(UtestShell* shell, TestPlugin* plugin, TestResult* result)
75+
static void GccPlatformSpecificRunTestInASeperateProcess(UtestShell* shell, TestPlugin* plugin, TestResult* result)
6976
{
7077
pid_t cpid, w;
7178
int status;
@@ -106,11 +113,6 @@ static void GccCygwinPlatformSpecificRunTestInASeperateProcess(UtestShell* shell
106113
}
107114
}
108115

109-
void (*PlatformSpecificRunTestInASeperateProcess)(UtestShell* shell, TestPlugin* plugin, TestResult* result) =
110-
GccCygwinPlatformSpecificRunTestInASeperateProcess;
111-
112-
#endif
113-
114116
static pid_t PlatformSpecificForkImplementation(void)
115117
{
116118
return fork();
@@ -121,11 +123,15 @@ static int PlatformSpecificWaitPidImplementation(int pid, int* status, int optio
121123
return waitpid(pid, status, options);
122124
}
123125

126+
#endif
127+
124128
TestOutput::WorkingEnvironment PlatformSpecificGetWorkingEnvironment()
125129
{
126130
return TestOutput::eclipse;
127131
}
128132

133+
void (*PlatformSpecificRunTestInASeperateProcess)(UtestShell* shell, TestPlugin* plugin, TestResult* result) =
134+
GccPlatformSpecificRunTestInASeperateProcess;
129135
int (*PlatformSpecificFork)(void) = PlatformSpecificForkImplementation;
130136
int (*PlatformSpecificWaitPid)(int, int*, int) = PlatformSpecificWaitPidImplementation;
131137

0 commit comments

Comments
 (0)