ObjFW  Check-in [9c28411f49]

Overview
Comment:Migrate OFSubprocessTests to ObjFWTest
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | objfwtest
Files: files | file ages | folders
SHA3-256: 9c28411f49f2459db03520884c258e73226a81b0b20bc081ab35a376cac4baa9
User & Date: js on 2024-02-11 21:46:00
Other Links: branch diff | manifest | tags
Context
2024-02-11
21:57
Migrate OFHMACTests to ObjFWTest check-in: e3fbb3ecea user: js tags: objfwtest
21:46
Migrate OFSubprocessTests to ObjFWTest check-in: 9c28411f49 user: js tags: objfwtest
21:29
Migrate OF*HashTests.m to ObjFWTest check-in: dda0ca9612 user: js tags: objfwtest
Changes

Modified .fossil-settings/clean-glob from [794c0e80bd] to [cc4d98d92f].

25
26
27
28
29
30
31

32
33
34
35
36
37
38
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39







+







docs
extra.mk
generators/library/gen_libraries
generators/unicode/gen_tables
new_tests/EBOOT.PBP
new_tests/PARAM.SFO
new_tests/plugin/Info.plist
new_tests/subprocess/subprocess
new_tests/testfile_bin.m
new_tests/tests
new_tests/tests.3dsx
new_tests/tests.arm9
new_tests/tests.nds
new_tests/tests.nro
new_tests/tests.rpx
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
47
48
49
50
51
52
53

54
55
56
57
58
59
60







-







src/tls/Info.plist
src/tls/libobjfwtls.*
tests/DerivedData
tests/EBOOT.PBP
tests/Info.plist
tests/PARAM.SFO
tests/objc_sync/objc_sync
tests/subprocess/subprocess
tests/terminal/terminal_tests
tests/testfile_bin.m
tests/testfile_ini.m
tests/tests
tests/tests.3dsx
tests/tests.arm9
tests/tests.nds

Modified .fossil-settings/ignore-glob from [1c080b0d69] to [1475b0f60e].

27
28
29
30
31
32
33

34
35
36
37
38
39
40
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41







+







docs
extra.mk
generators/library/gen_libraries
generators/unicode/gen_tables
new_tests/EBOOT.PBP
new_tests/PARAM.SFO
new_tests/plugin/Info.plist
new_tests/subprocess/subprocess
new_tests/testfile_bin.m
new_tests/tests
new_tests/tests.3dsx
new_tests/tests.arm9
new_tests/tests.nds
new_tests/tests.nro
new_tests/tests.rpx
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
52
53
54
55
56
57
58

59
60
61
62
63
64
65







-







tests/EBOOT.PBP
tests/Info.plist
tests/PARAM.SFO
tests/iOS.xcodeproj/*.pbxuser
tests/iOS.xcodeproj/project.xcworkspace
tests/iOS.xcodeproj/xcuserdata
tests/objc_sync/objc_sync
tests/subprocess/subprocess
tests/terminal/terminal_tests
tests/testfile_bin.m
tests/testfile_bin.m
tests/testfile_ini.m
tests/tests
tests/tests.3dsx
tests/tests.arm9

Modified .gitignore from [7bb7af0687] to [b086db5cd9].

27
28
29
30
31
32
33

34
35
36
37
38
39
40
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41







+







docs
extra.mk
generators/library/gen_libraries
generators/unicode/gen_tables
new_tests/EBOOT.PBP
new_tests/PARAM.SFO
new_tests/plugin/Info.plist
new_tests/subprocess/subprocess
new_tests/testfile_bin.m
new_tests/tests
new_tests/tests.3dsx
new_tests/tests.arm9
new_tests/tests.nds
new_tests/tests.nro
new_tests/tests.rpx
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
52
53
54
55
56
57
58

59
60
61
62
63
64
65







-







tests/EBOOT.PBP
tests/Info.plist
tests/PARAM.SFO
tests/iOS.xcodeproj/*.pbxuser
tests/iOS.xcodeproj/project.xcworkspace
tests/iOS.xcodeproj/xcuserdata
tests/objc_sync/objc_sync
tests/subprocess/subprocess
tests/terminal/terminal_tests
tests/testfile_bin.m
tests/testfile_ini.m
tests/tests
tests/tests.3dsx
tests/tests.arm9
tests/tests.nds

Modified configure.ac from [e916d27008] to [724633f612].

1977
1978
1979
1980
1981
1982
1983
1984

1985
1986
1987
1988
1989
1990
1991
1977
1978
1979
1980
1981
1982
1983

1984
1985
1986
1987
1988
1989
1990
1991







-
+







			])
		], [
			break
		])
	])
])
AS_IF([test x"$have_subprocesses" = x"yes"], [
	AC_SUBST(USE_SRCS_SUBPROCESS, '${SRCS_SUBPROCESS}')
	AC_SUBST(USE_SRCS_SUBPROCESSES, '${SRCS_SUBPROCESSES}')
	AC_SUBST(SUBPROCESS, "subprocess")
	AC_DEFINE(OF_HAVE_SUBPROCESSES, 1, [Whether we have subprocesses])
])

AC_CHECK_HEADERS_ONCE([complex.h sys/ioctl.h sys/ttycom.h])
AC_CHECK_FUNCS(ioctl isatty)

Modified extra.mk.in from [3687ff7a31] to [5cc5b370f7].

82
83
84
85
86
87
88
89

90
91
92
93
94
82
83
84
85
86
87
88

89
90
91
92
93
94







-
+





UNICODE_M = @UNICODE_M@
USE_INCLUDES_ATOMIC = @USE_INCLUDES_ATOMIC@
USE_SRCS_APPLETALK = @USE_SRCS_APPLETALK@
USE_SRCS_FILES = @USE_SRCS_FILES@
USE_SRCS_IPX = @USE_SRCS_IPX@
USE_SRCS_PLUGINS = @USE_SRCS_PLUGINS@
USE_SRCS_SOCKETS = @USE_SRCS_SOCKETS@
USE_SRCS_SUBPROCESS = @USE_SRCS_SUBPROCESS@
USE_SRCS_SUBPROCESSES = @USE_SRCS_SUBPROCESSES@
USE_SRCS_TAGGED_POINTERS = @USE_SRCS_TAGGED_POINTERS@
USE_SRCS_THREADS = @USE_SRCS_THREADS@
USE_SRCS_UNIX_SOCKETS = @USE_SRCS_UNIX_SOCKETS@
USE_SRCS_WINDOWS = @USE_SRCS_WINDOWS@
WRAPPER = @WRAPPER@

Modified new_tests/Makefile from [cc8be31588] to [c24013b9d0].

1
2
3

4
5
6
7
8
9
10
1
2

3
4
5
6
7
8
9
10


-
+







include ../extra.mk

SUBDIRS = ${TESTPLUGIN}
SUBDIRS = ${TESTPLUGIN} ${SUBPROCESS}

CLEAN = testfile_bin.m

PROG_NOINST = tests${PROG_SUFFIX}
SRCS = OFArrayTests.m			\
       OFCharacterSetTests.m		\
       OFColorTests.m			\
20
21
22
23
24
25
26

27
28
29

30
31
32
33
34
35
36
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38







+



+







       OFMutableArrayTests.m		\
       OFNumberTests.m			\
       OFPBKDF2Tests.m			\
       OFPropertyListTests.m		\
       OFScryptTests.m			\
       ${USE_SRCS_PLUGINS}		\
       ${USE_SRCS_SOCKETS}		\
       ${USE_SRCS_SUBPROCESSES}		\
       testfile_bin.m
SRCS_PLUGINS = OFPluginTests.m
SRCS_SOCKETS = OFSocketTests.m
SRCS_SUBPROCESSES = OFSubprocessTests.m

include ../buildsys.mk

testfile_bin.m: testfile.bin
	${SHELL} ../utils/objfw-embed testfile.bin testfile.bin $@

.PHONY: run run-on-ios run-on-android
146
147
148
149
150
151
152
153


154
155
156
157
158
159
160
161
162
163
164
165
148
149
150
151
152
153
154

155
156
157
158
159
160
161
162
163
164
165
166
167
168







-
+
+












	elf2rpl $< $@

CPPFLAGS += -I../src				\
	    -I../src/exceptions			\
	    -I../src/runtime			\
	    -I../src/test			\
	    -I..				\
	    -DOBJFWTEST_LOCAL_INCLUDES
	    -DOBJFWTEST_LOCAL_INCLUDES		\
	    -DPROG_SUFFIX=\"${PROG_SUFFIX}\"
# Repetition is required for Wii U, as otherwise it cannot find main. Just
# moving -lobjfwtest later doesn't work either, as then the linker cannot find
# ObjFW symbols. So the only solution is to list everything twice.
LIBS := -L../src/test	\
	-lobjfwtest	\
	${TESTS_LIBS}	\
	${LIBS}		\
	-lobjfwtest	\
	${TESTS_LIBS}	\
	${LIBS}
LDFLAGS += ${MAP_LDFLAGS}
LD = ${OBJC}

Renamed and modified tests/OFSubprocessTests.m [846e8d88e2] to new_tests/OFSubprocessTests.m [bf448d2b80].

11
12
13
14
15
16
17
18


19
20


21
22
23


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44




45
46

47
48
49

50
51

52
53
54


55
56
57
11
12
13
14
15
16
17

18
19
20

21
22
23


24
25
26

27
28
29
30
31
32
33
34
35
36
37
38
39






40
41
42
43
44

45



46
47

48
49


50
51


52







-
+
+

-
+
+

-
-
+
+

-













-
-
-
-
-
-
+
+
+
+

-
+
-
-
-
+

-
+

-
-
+
+
-
-

 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#import "TestsAppDelegate.h"
#import "ObjFW.h"
#import "ObjFWTest.h"

static OFString *const module = @"OFSubprocess";
@interface OFSubprocessTests: OTTestCase
@end

@implementation TestsAppDelegate (OFSubprocessTests)
- (void)subprocessTests
@implementation OFSubprocessTests
- (void)testSubprocess
{
	void *pool = objc_autoreleasePoolPush();
#ifdef OF_HAVE_FILES
	OFString *program = [@"subprocess" stringByAppendingPathComponent:
	    @"subprocess" @PROG_SUFFIX];
#else
	OFString *program = @"subprocess/subprocess" @PROG_SUFFIX;
#endif
	OFArray *arguments = [OFArray arrayWithObjects: @"tést", @"123", nil];
	OFMutableDictionary *environment =
	    [[[OFApplication environment] mutableCopy] autorelease];
	OFSubprocess *subprocess;

	[environment setObject: @"yés" forKey: @"tëst"];

	TEST(@"+[subprocessWithProgram:programName:arguments:environment]",
	    (subprocess =
	    [OFSubprocess subprocessWithProgram: program
				    programName: program
				      arguments: arguments
				    environment: environment]))
	subprocess = [OFSubprocess subprocessWithProgram: program
					     programName: program
					       arguments: arguments
					     environment: environment];

	TEST(@"Standard input", R([subprocess writeLine: @"Hellö world!"]))
	[subprocess writeLine: @"Hellö world!"];

	TEST(@"Standard output",
	    [[subprocess readLine] isEqual: @"HELLÖ WORLD!"])
	OTAssertEqualObjects([subprocess readLine], @"HELLÖ WORLD!");

	TEST(@"-[closeForWriting]", R([subprocess closeForWriting]))
	[subprocess closeForWriting];

	TEST(@"-[waitForTermination]", [subprocess waitForTermination] == 0)

	OTAssertEqual([subprocess waitForTermination], 0);
}
	objc_autoreleasePoolPop(pool);
}
@end

Name change from tests/subprocess/Makefile to new_tests/subprocess/Makefile.

Name change from tests/subprocess/Subprocess.m to new_tests/subprocess/Subprocess.m.

Modified src/Makefile from [faa3d6a6cb] to [cca3d2063b].

107
108
109
110
111
112
113
114

115
116
117
118
119
120
121
107
108
109
110
111
112
113

114
115
116
117
118
119
120
121







-
+







       OFXMLParser.m			\
       OFXMLProcessingInstruction.m	\
       OFZIPArchive.m			\
       OFZIPArchiveEntry.m		\
       ${USE_SRCS_FILES}		\
       ${USE_SRCS_PLUGINS}		\
       ${USE_SRCS_SOCKETS}		\
       ${USE_SRCS_SUBPROCESS}		\
       ${USE_SRCS_SUBPROCESSES}		\
       ${USE_SRCS_THREADS}		\
       ${USE_SRCS_WINDOWS}
SRCS_FILES = OFFile.m			\
	     OFString+PathAdditions.m
SRCS_PLUGINS = OFPlugin.m
SRCS_SOCKETS = OFAAAADNSResourceRecord.m	\
	       OFADNSResourceRecord.m		\
153
154
155
156
157
158
159
160

161
162
163
164
165
166
167
153
154
155
156
157
158
159

160
161
162
163
164
165
166
167







-
+







	       ${USE_SRCS_UNIX_SOCKETS}
SRCS_APPLETALK = OFDDPSocket.m
SRCS_IPX = OFIPXSocket.m	\
	   OFSPXSocket.m	\
	   OFSPXStreamSocket.m
SRCS_UNIX_SOCKETS = OFUNIXDatagramSocket.m	\
		    OFUNIXStreamSocket.m
SRCS_SUBPROCESS = OFSubprocess.m
SRCS_SUBPROCESSES = OFSubprocess.m
SRCS_THREADS = OFCondition.m		\
	       OFMutex.m		\
	       OFPlainCondition.m	\
	       OFPlainMutex.m		\
	       OFPlainThread.m		\
	       OFRecursiveMutex.m	\
	       OFTLSKey.m

Modified tests/Makefile from [edbc541766] to [1d6befcb93].

1
2
3
4
5
6
7
8
9
10
11
1
2
3

4
5
6
7
8
9
10



-







include ../extra.mk

SUBDIRS = ${OBJC_SYNC}	\
	  ${SUBPROCESS}	\
	  terminal

CLEAN = EBOOT.PBP		\
	boot.dol		\
	${PROG_NOINST}.arm9	\
	${PROG_NOINST}.nds	\
	${PROG_NOINST}.nro	\
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
35
36
37
38
39
40
41

42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

62
63
64
65
66
67
68







-




















-







       OFXMLNodeTests.m			\
       OFXMLParserTests.m		\
       RuntimeTests.m			\
       ${RUNTIME_ARC_TESTS_M}		\
       TestsAppDelegate.m		\
       ${USE_SRCS_FILES}		\
       ${USE_SRCS_SOCKETS}		\
       ${USE_SRCS_SUBPROCESS}		\
       ${USE_SRCS_THREADS}		\
       ${USE_SRCS_WINDOWS}		\
       testfile_bin.m			\
       testfile_ini.m
SRCS_SOCKETS = OFDNSResolverTests.m		\
	       ${OF_HTTP_CLIENT_TESTS_M}	\
	       OFHTTPCookieTests.m		\
	       OFHTTPCookieManagerTests.m	\
	       OFKernelEventObserverTests.m	\
	       OFTCPSocketTests.m		\
	       OFUDPSocketTests.m		\
	       ${USE_SRCS_APPLETALK}		\
	       ${USE_SRCS_IPX}			\
	       ${USE_SRCS_UNIX_SOCKETS}
SRCS_APPLETALK = OFDDPSocketTests.m
SRCS_IPX = OFIPXSocketTests.m		\
	   OFSPXSocketTests.m		\
	   OFSPXStreamSocketTests.m
SRCS_UNIX_SOCKETS = OFUNIXDatagramSocketTests.m	\
		    OFUNIXStreamSocketTests.m
SRCS_SUBPROCESS = OFSubprocessTests.m
SRCS_THREADS = OFThreadTests.m
SRCS_WINDOWS = OFWindowsRegistryKeyTests.m

IOS_USER ?= mobile
IOS_TMP ?= /tmp/objfw-test

include ../buildsys.mk
183
184
185
186
187
188
189
190

191
192
193
194
195
180
181
182
183
184
185
186

187

188
189
190
191







-
+
-




${PROG_NOINST}.rpx: ${PROG_NOINST}
	elf2rpl $< $@

CPPFLAGS += -I../src				\
	    -I../src/exceptions			\
	    -I../src/runtime			\
	    -I..				\
	    -DSTDOUT				\
	    -DSTDOUT
	    -DPROG_SUFFIX=\"${PROG_SUFFIX}\"
OBJCFLAGS_RuntimeARCTests.m = -fobjc-arc -fobjc-arc-exceptions
LIBS := ${TESTS_LIBS} ${LIBS}
LDFLAGS += ${MAP_LDFLAGS}
LD = ${OBJC}

Modified tests/TestsAppDelegate.h from [f27d6636eb] to [ed4410669a].

159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
159
160
161
162
163
164
165




166
167
168
169
170
171
172







-
-
-
-







- (void)streamTests;
@end

@interface TestsAppDelegate (OFStringTests)
- (void)stringTests;
@end

@interface TestsAppDelegate (OFSubprocessTests)
- (void)subprocessTests;
@end

@interface TestsAppDelegate (OFTCPSocketTests)
- (void)TCPSocketTests;
@end

@interface TestsAppDelegate (OFThreadTests)
- (void)threadTests;
@end

Modified tests/TestsAppDelegate.m from [62aaab333c] to [3c96b957f7].

419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
419
420
421
422
423
424
425



426
427
428
429
430
431
432







-
-
-







	[self HTTPCookieTests];
	[self HTTPCookieManagerTests];
#endif
	[self XMLParserTests];
	[self XMLNodeTests];
	[self XMLElementBuilderTests];

#ifdef OF_HAVE_SUBPROCESSES
	[self subprocessTests];
#endif
#ifdef OF_WINDOWS
	[self windowsRegistryKeyTests];
#endif

#ifdef OF_HAVE_SOCKETS
	[self DNSResolverTests];
#endif