Overview
Comment: | Migrate OFUNIXStreamSocketTests to ObjFWTest |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | objfwtest |
Files: | files | file ages | folders |
SHA3-256: |
b77972796e222c318f80b272b088209c |
User & Date: | js on 2024-02-13 23:48:45 |
Other Links: | branch diff | manifest | tags |
Context
2024-02-13
| ||
23:57 | Migrate OFIPXSocketTests to ObjFWTest check-in: 1b119ef77e user: js tags: objfwtest | |
23:48 | Migrate OFUNIXStreamSocketTests to ObjFWTest check-in: b77972796e user: js tags: objfwtest | |
23:41 | Migrate OFUNIXDatagramSocketTests to ObjFWTest check-in: 0c3f6027a2 user: js tags: objfwtest | |
Changes
Modified new_tests/Makefile from [9ff0bc1e70] to [bd660bc7cf].
︙ | ︙ | |||
48 49 50 51 52 53 54 | testfile_ini.m SRCS_PLUGINS = OFPluginTests.m SRCS_SOCKETS = OFDNSResolverTests.m \ OFSocketTests.m \ OFTCPSocketTests.m \ OFUDPSocketTests.m \ ${USE_SRCS_UNIX_SOCKETS} | | > | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | testfile_ini.m SRCS_PLUGINS = OFPluginTests.m SRCS_SOCKETS = OFDNSResolverTests.m \ OFSocketTests.m \ OFTCPSocketTests.m \ OFUDPSocketTests.m \ ${USE_SRCS_UNIX_SOCKETS} SRCS_UNIX_SOCKETS = OFUNIXDatagramSocketTests.m \ OFUNIXStreamSocketTests.m SRCS_SUBPROCESSES = OFSubprocessTests.m SRCS_THREADS = OFThreadTests.m include ../buildsys.mk testfile_bin.m: testfile.bin ${SHELL} ../utils/objfw-embed testfile.bin testfile.bin $@ |
︙ | ︙ |
Modified new_tests/OFUNIXDatagramSocketTests.m from [380c509734] to [cd285c23b4].
︙ | ︙ | |||
21 22 23 24 25 26 27 | #import "ObjFW.h" #import "ObjFWTest.h" @interface OFUNIXDatagramSocketTests: OTTestCase @end @implementation OFUNIXDatagramSocketTests | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #import "ObjFW.h" #import "ObjFWTest.h" @interface OFUNIXDatagramSocketTests: OTTestCase @end @implementation OFUNIXDatagramSocketTests - (void)testUNIXDatagramSocket { OFUNIXDatagramSocket *sock = [OFUNIXDatagramSocket socket]; OFString *path; OFSocketAddress address1, address2; char buffer[5]; #if defined(OF_HAVE_FILES) && !defined(OF_IOS) |
︙ | ︙ | |||
51 52 53 54 55 56 57 | @try { address1 = [sock bindToPath: path]; } @catch (OFBindSocketFailedException *e) { switch (e.errNo) { case EAFNOSUPPORT: case EPERM: OTSkip(@"UNIX datagram sockets unsupported"); | < | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | @try { address1 = [sock bindToPath: path]; } @catch (OFBindSocketFailedException *e) { switch (e.errNo) { case EAFNOSUPPORT: case EPERM: OTSkip(@"UNIX datagram sockets unsupported"); default: @throw e; } } @try { [sock sendBuffer: "Hello" length: 5 receiver: &address1]; |
︙ | ︙ |
Renamed and modified tests/OFUNIXStreamSocketTests.m [b3f4ed0fcd] to new_tests/OFUNIXStreamSocketTests.m [404c597141].
︙ | ︙ | |||
12 13 14 15 16 17 18 19 | * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #include <errno.h> | > | > | > | | < | | | < < < | < < < | < | | < < | < | | | | | < < | 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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #include <errno.h> #include <string.h> #import "ObjFW.h" #import "ObjFWTest.h" @interface OFUNIXStreamSocketTests: OTTestCase @end @implementation OFUNIXStreamSocketTests - (void)testUNIXStreamSocket { OFString *path; OFUNIXStreamSocket *sockClient, *sockServer, *sockAccepted; char buffer[5]; #if defined(OF_HAVE_FILES) && !defined(OF_IOS) path = [[OFSystemInfo temporaryDirectoryIRI] IRIByAppendingPathComponent: [[OFUUID UUID] UUIDString]] .fileSystemRepresentation; #else /* * We can have sockets, including UNIX sockets, while file support is * disabled. * * We also use this code path for iOS, as the temporaryDirectory:RI is * too long on the iOS simulator. */ path = [OFString stringWithFormat: @"/tmp/%@", [[OFUUID UUID] UUIDString]]; #endif sockClient = [OFUNIXStreamSocket socket]; sockServer = [OFUNIXStreamSocket socket]; @try { [sockServer bindToPath: path]; } @catch (OFBindSocketFailedException *e) { switch (e.errNo) { case EAFNOSUPPORT: case EPERM: OTSkip(@"UNIX stream sockets unsupported"); default: @throw e; } } @try { [sockServer listen]; [sockClient connectToPath: path]; sockAccepted = [sockServer accept]; [sockAccepted writeBuffer: "Hello" length: 5]; OTAssertEqual([sockClient readIntoBuffer: buffer length: 5], 5); OTAssertEqual(memcmp(buffer, "Hello", 5), 0); OTAssertEqual(OFSocketAddressUNIXPath( sockAccepted.remoteAddress).length, 0); } @finally { #ifdef OF_HAVE_FILES [[OFFileManager defaultManager] removeItemAtPath: path]; #endif } } @end |
Modified tests/Makefile from [96a14c6d55] to [d29c8d2b6b].
︙ | ︙ | |||
31 32 33 34 35 36 37 | ${USE_SRCS_SOCKETS} \ ${USE_SRCS_WINDOWS} SRCS_SOCKETS = ${OF_HTTP_CLIENT_TESTS_M} \ OFHTTPCookieTests.m \ OFHTTPCookieManagerTests.m \ OFKernelEventObserverTests.m \ ${USE_SRCS_APPLETALK} \ | | < < | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | ${USE_SRCS_SOCKETS} \ ${USE_SRCS_WINDOWS} SRCS_SOCKETS = ${OF_HTTP_CLIENT_TESTS_M} \ OFHTTPCookieTests.m \ OFHTTPCookieManagerTests.m \ OFKernelEventObserverTests.m \ ${USE_SRCS_APPLETALK} \ ${USE_SRCS_IPX} SRCS_APPLETALK = OFDDPSocketTests.m SRCS_IPX = OFIPXSocketTests.m \ OFSPXSocketTests.m \ OFSPXStreamSocketTests.m SRCS_WINDOWS = OFWindowsRegistryKeyTests.m IOS_USER ?= mobile IOS_TMP ?= /tmp/objfw-test include ../buildsys.mk |
︙ | ︙ |
Modified tests/TestsAppDelegate.h from [94c78fc85a] to [c0feb7d760].
︙ | ︙ | |||
123 124 125 126 127 128 129 | - (void)streamTests; @end @interface TestsAppDelegate (OFStringTests) - (void)stringTests; @end | < < < < | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | - (void)streamTests; @end @interface TestsAppDelegate (OFStringTests) - (void)stringTests; @end @interface TestsAppDelegate (OFValueTests) - (void)valueTests; @end @interface TestsAppDelegate (OFWindowsRegistryKeyTests) - (void)windowsRegistryKeyTests; @end |
︙ | ︙ |
Modified tests/TestsAppDelegate.m from [bdc9d92508] to [c53e2faa86].
︙ | ︙ | |||
379 380 381 382 383 384 385 | [self dictionaryTests]; [self listTests]; [self valueTests]; [self streamTests]; [self memoryStreamTests]; [self notificationCenterTests]; #ifdef OF_HAVE_SOCKETS | < < < | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | [self dictionaryTests]; [self listTests]; [self valueTests]; [self streamTests]; [self memoryStreamTests]; [self notificationCenterTests]; #ifdef OF_HAVE_SOCKETS # ifdef OF_HAVE_IPX [self IPXSocketTests]; [self SPXSocketTests]; [self SPXStreamSocketTests]; # endif # ifdef OF_HAVE_APPLETALK [self DDPSocketTests]; |
︙ | ︙ |