mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
* Do not enable Win32 threads and locks when using GCC * Fix compiler check when CC has arguments appended * Add NSConstantString literal as global variable to avoid linker error * Make libcurl a hard-dependency on ObjC 2.0 Toolchain * Bump TOOLS_WINDOWS_MSVC_RELEASE_TAG * Remove x86 runner for MSVC toolchain * Add libcurl to MinGW x64 Clang toolchain * MSVC toolchain requires Windows 1903 and newer but windows-2019 runner is Redstone 5 (1809) * MinGW GCC adds .exe suffix * Some tests timeout after 30s. Increase timeout * Mark late unregister as hopeful on Win32 with GCC * Mark NSURL test depending on network connection as hopeful
69 lines
1.9 KiB
Objective-C
69 lines
1.9 KiB
Objective-C
#import <Foundation/NSAutoreleasePool.h>
|
|
#import <Foundation/NSTask.h>
|
|
#import <Foundation/NSFileManager.h>
|
|
#import <Foundation/NSProcessInfo.h>
|
|
#import <Foundation/NSBundle.h>
|
|
#import "ObjectTesting.h"
|
|
|
|
int main()
|
|
{
|
|
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
|
NSFileManager *mgr;
|
|
NSString *helpers;
|
|
NSString *testecho;
|
|
NSString *testcat;
|
|
NSArray *args;
|
|
id task;
|
|
id info;
|
|
id env;
|
|
id pth1;
|
|
id pth2;
|
|
BOOL yes;
|
|
|
|
/* Windows Compiler add the '.exe' suffix to executables
|
|
*/
|
|
#if defined(_WIN32)
|
|
testecho = @"testecho.exe";
|
|
testcat = @"testcat.exe";
|
|
#else
|
|
testecho = @"testecho";
|
|
testcat = @"testcat";
|
|
#endif
|
|
|
|
info = [NSProcessInfo processInfo];
|
|
env = [[info environment] mutableCopy];
|
|
yes = YES;
|
|
|
|
PASS(info != nil && [info isKindOfClass: [NSProcessInfo class]]
|
|
&& env != nil && [env isKindOfClass: [NSMutableDictionary class]]
|
|
&& yes == YES,
|
|
"We can build some objects for task tests");
|
|
|
|
mgr = [NSFileManager defaultManager];
|
|
helpers = [mgr currentDirectoryPath];
|
|
helpers = [helpers stringByAppendingPathComponent: @"Helpers"];
|
|
helpers = [helpers stringByAppendingPathComponent: @"obj"];
|
|
|
|
pth1 = [helpers stringByAppendingPathComponent: testcat];
|
|
pth2 = [helpers stringByAppendingPathComponent: testecho];
|
|
|
|
/* Try some tasks. Make sure the program we use is common between Unix
|
|
and Windows (and others?) */
|
|
task = [NSTask launchedTaskWithLaunchPath: pth1
|
|
arguments: [NSArray array]];
|
|
[task waitUntilExit];
|
|
PASS(YES, "launchedTaskWithLaunchPath:arguments: works");
|
|
|
|
task = [NSTask new];
|
|
args = [NSArray arrayWithObjects: @"xxx", @"yyy", nil];
|
|
[task setEnvironment: env];
|
|
[task setLaunchPath: pth2];
|
|
[task setArguments: args];
|
|
[task launch];
|
|
[task waitUntilExit];
|
|
PASS([task terminationReason] == NSTaskTerminationReasonExit,
|
|
"termination reason for normal exit works");
|
|
|
|
[arp release]; arp = nil;
|
|
return 0;
|
|
}
|