Author: rfm
Date: Fri Jul  1 17:22:35 2016
New Revision: 39957

URL: http://svn.gna.org/viewcvs/gnustep?rev=39957&view=rev
Log:
Some testcase reliability improvements

Added:
    libs/base/trunk/Tests/base/NSTask/Helpers/testsleep.m
Modified:
    libs/base/trunk/Tests/base/NSBundle/Resources/GNUmakefile
    libs/base/trunk/Tests/base/NSLock/Helpers/GNUmakefile
    libs/base/trunk/Tests/base/NSTask/Helpers/GNUmakefile
    libs/base/trunk/Tests/base/NSTask/notify.m
    libs/base/trunk/Tests/base/NSURL/Helpers/GNUmakefile
    libs/base/trunk/Tests/base/NSURLConnection/Helpers/GNUmakefile
    libs/base/trunk/Tests/base/NSURLHandle/Helpers/GNUmakefile

Modified: libs/base/trunk/Tests/base/NSBundle/Resources/GNUmakefile
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Tests/base/NSBundle/Resources/GNUmakefile?rev=39957&r1=39956&r2=39957&view=diff
==============================================================================
--- libs/base/trunk/Tests/base/NSBundle/Resources/GNUmakefile   (original)
+++ libs/base/trunk/Tests/base/NSBundle/Resources/GNUmakefile   Fri Jul  1 
17:22:35 2016
@@ -1,6 +1,7 @@
 
 include $(GNUSTEP_MAKEFILES)/common.make
 
+NEEDS_GUI=no
 BUNDLE_NAME = TestBundle
 FRAMEWORK_NAME = TestFramework
 

Modified: libs/base/trunk/Tests/base/NSLock/Helpers/GNUmakefile
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Tests/base/NSLock/Helpers/GNUmakefile?rev=39957&r1=39956&r2=39957&view=diff
==============================================================================
--- libs/base/trunk/Tests/base/NSLock/Helpers/GNUmakefile       (original)
+++ libs/base/trunk/Tests/base/NSLock/Helpers/GNUmakefile       Fri Jul  1 
17:22:35 2016
@@ -3,11 +3,11 @@
 
 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

Modified: libs/base/trunk/Tests/base/NSTask/Helpers/GNUmakefile
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Tests/base/NSTask/Helpers/GNUmakefile?rev=39957&r1=39956&r2=39957&view=diff
==============================================================================
--- libs/base/trunk/Tests/base/NSTask/Helpers/GNUmakefile       (original)
+++ libs/base/trunk/Tests/base/NSTask/Helpers/GNUmakefile       Fri Jul  1 
17:22:35 2016
@@ -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

Added: libs/base/trunk/Tests/base/NSTask/Helpers/testsleep.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Tests/base/NSTask/Helpers/testsleep.m?rev=39957&view=auto
==============================================================================
--- libs/base/trunk/Tests/base/NSTask/Helpers/testsleep.m       (added)
+++ libs/base/trunk/Tests/base/NSTask/Helpers/testsleep.m       Fri Jul  1 
17:22:35 2016
@@ -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;
+}
+

Modified: libs/base/trunk/Tests/base/NSTask/notify.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Tests/base/NSTask/notify.m?rev=39957&r1=39956&r2=39957&view=diff
==============================================================================
--- libs/base/trunk/Tests/base/NSTask/notify.m  (original)
+++ libs/base/trunk/Tests/base/NSTask/notify.m  Fri Jul  1 17:22:35 2016
@@ -38,19 +38,19 @@
     {
       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 @@
             {
               [[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 @@
   TaskHandler   *h;
   NSFileManager *mgr;
   NSString      *helpers;
-  NSString      *lp;
 
   START_SET("notify");
   mgr = [NSFileManager defaultManager];
@@ -107,10 +114,8 @@
   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];
 

Modified: libs/base/trunk/Tests/base/NSURL/Helpers/GNUmakefile
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Tests/base/NSURL/Helpers/GNUmakefile?rev=39957&r1=39956&r2=39957&view=diff
==============================================================================
--- libs/base/trunk/Tests/base/NSURL/Helpers/GNUmakefile        (original)
+++ libs/base/trunk/Tests/base/NSURL/Helpers/GNUmakefile        Fri Jul  1 
17:22:35 2016
@@ -3,14 +3,13 @@
 
 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

Modified: libs/base/trunk/Tests/base/NSURLConnection/Helpers/GNUmakefile
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Tests/base/NSURLConnection/Helpers/GNUmakefile?rev=39957&r1=39956&r2=39957&view=diff
==============================================================================
--- libs/base/trunk/Tests/base/NSURLConnection/Helpers/GNUmakefile      
(original)
+++ libs/base/trunk/Tests/base/NSURLConnection/Helpers/GNUmakefile      Fri Jul 
 1 17:22:35 2016
@@ -1,17 +1,16 @@
 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

Modified: libs/base/trunk/Tests/base/NSURLHandle/Helpers/GNUmakefile
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Tests/base/NSURLHandle/Helpers/GNUmakefile?rev=39957&r1=39956&r2=39957&view=diff
==============================================================================
--- libs/base/trunk/Tests/base/NSURLHandle/Helpers/GNUmakefile  (original)
+++ libs/base/trunk/Tests/base/NSURLHandle/Helpers/GNUmakefile  Fri Jul  1 
17:22:35 2016
@@ -3,8 +3,9 @@
 
 TOOL_NAME = StatusServer
 
+NEEDS_GUI = NO
+
 StatusServer_OBJC_FILES = StatusServer.m
-StatusServer_NEEDS_GUI = NO
 
 -include GNUmakefile.preamble
 include $(GNUSTEP_MAKEFILES)/tool.make


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to