mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
Some testcase reliability improvements
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39957 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f3423437a8
commit
1213e12424
8 changed files with 51 additions and 30 deletions
|
@ -1,6 +1,7 @@
|
|||
|
||||
include $(GNUSTEP_MAKEFILES)/common.make
|
||||
|
||||
NEEDS_GUI=no
|
||||
BUNDLE_NAME = TestBundle
|
||||
FRAMEWORK_NAME = TestFramework
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@ include $(GNUSTEP_MAKEFILES)/common.make
|
|||
|
||||
TOOL_NAME = doubleNSLock doubleNSConditionLock
|
||||
|
||||
NEEDS_GUI = NO
|
||||
|
||||
doubleNSLock_OBJC_FILES = doubleNSLock.m
|
||||
doubleNSLock_NEEDS_GUI = NO
|
||||
|
||||
doubleNSConditionLock_OBJC_FILES = doubleNSConditionLock.m
|
||||
doubleNSConditionLock_NEEDS_GUI = NO
|
||||
|
||||
-include GNUmakefile.preamble
|
||||
include $(GNUSTEP_MAKEFILES)/tool.make
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
|
||||
include $(GNUSTEP_MAKEFILES)/common.make
|
||||
|
||||
TOOL_NAME = NSZombie processgroup testcat testecho
|
||||
TOOL_NAME = NSZombie processgroup testcat testecho testsleep
|
||||
|
||||
NEEDS_GUI = NO
|
||||
|
||||
NSZombie_OBJC_FILES = NSZombie.m
|
||||
NSZombie_NEEDS_GUI = NO
|
||||
|
||||
processgroup_OBJC_FILES = processgroup.m
|
||||
processgroup_NEEDS_GUI = NO
|
||||
|
||||
testcat_OBJC_FILES = testcat.m
|
||||
testcat_NEEDS_GUI = NO
|
||||
|
||||
testecho_OBJC_FILES = testecho.m
|
||||
testecho_NEEDS_GUI = NO
|
||||
|
||||
testsleep_OBJC_FILES = testsleep.m
|
||||
|
||||
-include GNUmakefile.preamble
|
||||
include $(GNUSTEP_MAKEFILES)/tool.make
|
||||
|
|
16
Tests/base/NSTask/Helpers/testsleep.m
Normal file
16
Tests/base/NSTask/Helpers/testsleep.m
Normal file
|
@ -0,0 +1,16 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
|
||||
GSPrintf(stdout, @"Child starting\n");
|
||||
fflush(stdout);
|
||||
[NSThread sleepForTimeInterval: 10.0];
|
||||
GSPrintf(stdout, @"Child exiting\n");
|
||||
fflush(stdout);
|
||||
[arp release];
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -38,19 +38,19 @@ static BOOL taskTerminationNotificationReceived;
|
|||
{
|
||||
NSTask *task = [NSTask new];
|
||||
|
||||
[task setLaunchPath: path];
|
||||
[task setArguments: [NSArray arrayWithObjects:
|
||||
@"-c", @"echo Child starting; sleep 10; echo Child exiting", nil]];
|
||||
taskTerminationNotificationReceived = NO;
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(taskDidTerminate:)
|
||||
name: NSTaskDidTerminateNotification
|
||||
object: task];
|
||||
[task launch];
|
||||
NSLog(@"Launched pid %d", [task processIdentifier]);
|
||||
if (earlyTermination)
|
||||
{
|
||||
BOOL terminated = NO;
|
||||
[task setLaunchPath:
|
||||
[path stringByAppendingPathComponent: @"testsleep"]];
|
||||
[task launch];
|
||||
NSLog(@"Launched pid %d", [task processIdentifier]);
|
||||
NSLog(@"Running run loop for 5 seconds");
|
||||
deadline = [NSDate dateWithTimeIntervalSinceNow:5.0];
|
||||
while ([deadline timeIntervalSinceNow] > 0.0
|
||||
|
@ -58,17 +58,25 @@ static BOOL taskTerminationNotificationReceived;
|
|||
{
|
||||
[[NSRunLoop currentRunLoop]
|
||||
runUntilDate: [NSDate dateWithTimeIntervalSinceNow: 1.0]];
|
||||
NSLog(@"Run loop finished, will now call -[NSTask terminate]");
|
||||
[task terminate];
|
||||
NSLog(@"Terminate returned, waiting for termination");
|
||||
[task waitUntilExit];
|
||||
PASS([task terminationReason]
|
||||
== NSTaskTerminationReasonUncaughtSignal,
|
||||
"termination reason for signal exit works");
|
||||
if (NO == terminated)
|
||||
{
|
||||
NSLog(@"Run loop finished, calling -[NSTask terminate]");
|
||||
[task terminate];
|
||||
NSLog(@"Terminate returned, waiting for termination");
|
||||
terminated = YES;
|
||||
}
|
||||
}
|
||||
[task waitUntilExit];
|
||||
PASS([task terminationReason]
|
||||
== NSTaskTerminationReasonUncaughtSignal,
|
||||
"termination reason for signal exit works");
|
||||
}
|
||||
else
|
||||
{
|
||||
[task setLaunchPath:
|
||||
[path stringByAppendingPathComponent: @"testecho"]];
|
||||
[task launch];
|
||||
NSLog(@"Launched pid %d", [task processIdentifier]);
|
||||
NSLog(@"Running run loop for 15 seconds");
|
||||
deadline = [NSDate dateWithTimeIntervalSinceNow: 15.0];
|
||||
while ([deadline timeIntervalSinceNow] > 0.0
|
||||
|
@ -99,7 +107,6 @@ int main()
|
|||
TaskHandler *h;
|
||||
NSFileManager *mgr;
|
||||
NSString *helpers;
|
||||
NSString *lp;
|
||||
|
||||
START_SET("notify");
|
||||
mgr = [NSFileManager defaultManager];
|
||||
|
@ -107,10 +114,8 @@ int main()
|
|||
helpers = [helpers stringByAppendingPathComponent: @"Helpers"];
|
||||
helpers = [helpers stringByAppendingPathComponent: @"obj"];
|
||||
|
||||
lp = [helpers stringByAppendingPathComponent: @"testecho"];
|
||||
|
||||
h = [TaskHandler new];
|
||||
[h setLaunchPath: lp];
|
||||
[h setLaunchPath: helpers];
|
||||
[h testNSTaskNotifications];
|
||||
[h release];
|
||||
|
||||
|
|
|
@ -3,14 +3,13 @@ include $(GNUSTEP_MAKEFILES)/common.make
|
|||
|
||||
TOOL_NAME = capture respond keepalive
|
||||
|
||||
NEEDS_GUI = NO
|
||||
|
||||
capture_OBJC_FILES = capture.m
|
||||
capture_NEEDS_GUI = NO
|
||||
|
||||
respond_OBJC_FILES = respond.m
|
||||
respond_NEEDS_GUI = NO
|
||||
|
||||
keepalive_OBJC_FILES = keepalive.m
|
||||
keepalive_NEEDS_GUI = NO
|
||||
|
||||
-include GNUmakefile.preamble
|
||||
include $(GNUSTEP_MAKEFILES)/tool.make
|
||||
|
|
|
@ -2,16 +2,15 @@ include $(GNUSTEP_MAKEFILES)/common.make
|
|||
|
||||
BUNDLE_NAME = TestConnection
|
||||
|
||||
NEEDS_GUI=NO
|
||||
|
||||
TestConnection_OBJC_FILES = TestCase.m SimpleWebServer.m TestWebServer.m NSURLConnectionTest.m RequestHandler.m
|
||||
#TestConnection_OBJC_LIBS += -lWebServer -lPerformance
|
||||
TestConnection_RESOURCE_FILES += testKey.pem testCert.pem
|
||||
TestConnection_PRINCIPAL_CLASS = NSURLConnectionTest
|
||||
|
||||
StatusServer_NEEDS_GUI = NO
|
||||
|
||||
TOOL_NAME = testTestWebServer
|
||||
testTestWebServer_OBJC_FILES += testTestWebServer.m
|
||||
testTestWebServer_NEEDS_GUI = NO
|
||||
|
||||
-include GNUmakefile.preamble
|
||||
include $(GNUSTEP_MAKEFILES)/bundle.make
|
||||
|
|
|
@ -3,8 +3,9 @@ include $(GNUSTEP_MAKEFILES)/common.make
|
|||
|
||||
TOOL_NAME = StatusServer
|
||||
|
||||
NEEDS_GUI = NO
|
||||
|
||||
StatusServer_OBJC_FILES = StatusServer.m
|
||||
StatusServer_NEEDS_GUI = NO
|
||||
|
||||
-include GNUmakefile.preamble
|
||||
include $(GNUSTEP_MAKEFILES)/tool.make
|
||||
|
|
Loading…
Reference in a new issue