From f76a2bfa6675bb6de3143194099ae8e8a3d73c32 Mon Sep 17 00:00:00 2001 From: Tom Doron Date: Tue, 17 Oct 2017 09:51:59 -0700 Subject: [PATCH] sort linux tests motivation: generated linux tests dont have consitent sorting in different OSs changes: * change test generator to sort tests and imports in memory before writing to file * update LinuxMain to the sorted version --- Tests/LinuxMain.swift | 32 ++++++++++++++++---------------- generate_linux_tests.rb | 9 +++++++-- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift index ee75c3544..49cfb0605 100644 --- a/Tests/LinuxMain.swift +++ b/Tests/LinuxMain.swift @@ -23,29 +23,29 @@ import XCTest /// #if os(Linux) || os(FreeBSD) - @testable import NIOTests - @testable import NIOOpenSSLTests @testable import NIOHTTP1Tests + @testable import NIOOpenSSLTests + @testable import NIOTests XCTMain([ - testCase(MarkedCircularBufferTests.allTests), - testCase(TypeAssistedChannelHandlerTest.allTests), - testCase(CircularBufferTests.allTests), testCase(AdaptiveRecvByteBufferAllocatorTest.allTests), - testCase(EchoServerClientTest.allTests), - testCase(ByteToMessageDecoderTest.allTests), - testCase(MessageToByteEncoderTest.allTests), - testCase(FileRegionTest.allTests), testCase(ByteBufferTest.allTests), - testCase(EmbeddedChannelTest.allTests), + testCase(ByteToMessageDecoderTest.allTests), testCase(ChannelPipelineTest.allTests), - testCase(SocketAddressTest.allTests), - testCase(FutureTest.allTests), + testCase(CircularBufferTests.allTests), + testCase(EchoServerClientTest.allTests), + testCase(EmbeddedChannelTest.allTests), testCase(EventLoopTest.allTests), - testCase(OpenSSLIntegrationTest.allTests), - testCase(HTTPServerClientTest.allTests), - testCase(HTTPHeadersTest.allTests), - testCase(HTTPTest.allTests), + testCase(FileRegionTest.allTests), + testCase(FutureTest.allTests), testCase(HTTPEncoderTests.allTests), + testCase(HTTPHeadersTest.allTests), + testCase(HTTPServerClientTest.allTests), + testCase(HTTPTest.allTests), + testCase(MarkedCircularBufferTests.allTests), + testCase(MessageToByteEncoderTest.allTests), + testCase(OpenSSLIntegrationTest.allTests), + testCase(SocketAddressTest.allTests), + testCase(TypeAssistedChannelHandlerTest.allTests), ]) #endif \ No newline at end of file diff --git a/generate_linux_tests.rb b/generate_linux_tests.rb index 2344048b6..8f40a030d 100755 --- a/generate_linux_tests.rb +++ b/generate_linux_tests.rb @@ -85,17 +85,22 @@ def createLinuxMain(testsDirectory, allTestSubDirectories, files) file.write "\n" file.write "#if os(Linux) || os(FreeBSD)\n" - for testSubDirectory in allTestSubDirectories + for testSubDirectory in allTestSubDirectories.sort { |x,y| x <=> y } file.write " @testable import " + testSubDirectory + "\n" end file.write "\n" file.write " XCTMain([\n" + testCases = [] for classes in files for classArray in classes - file.write " testCase(" + classArray[0] + ".allTests),\n" + testCases << classArray[0] end end + + for testCase in testCases.sort { |x,y| x <=> y } + file.write " testCase(" + testCase + ".allTests),\n" + end file.write" ])\n" file.write "#endif" }