Skip to content

[StdLib] Extend ReflectionHashing test to pass on Linux #905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 8, 2016
Merged

[StdLib] Extend ReflectionHashing test to pass on Linux #905

merged 1 commit into from
Jan 8, 2016

Conversation

ezephir
Copy link

@ezephir ezephir commented Jan 7, 2016

Add a test case for X86_64 platforms that do not use Objective-C interop
and removes the XFAIL on Linux. Partially resolves SR-216.

This change passes the normal test suite on OS X 10.10 and Unbuntu 14.04.

The core reason the tests fail is because String is hashed differently depending on whether or not the platform supports the Obj-C runtime. Foundation's hashcode is used when the runtime is present and the built-in hashcode function is used otherwise. This seems reasonable, so I've extended the test with a new case.

Add a test case for X86_64 platforms that do not use Objective-C interop
and removes the XFAIL on Linux. Partially resolves SR-216.
@moiseev
Copy link
Contributor

moiseev commented Jan 8, 2016

Thanks! 👍

moiseev added a commit that referenced this pull request Jan 8, 2016
[StdLib] Extend ReflectionHashing test to pass on Linux
@moiseev moiseev merged commit 2da07db into swiftlang:master Jan 8, 2016
@dcci
Copy link
Member

dcci commented Jan 10, 2016

Sorry to rain on your parade, but this broke my Fedora buildbot. Can you please take a look?


FAIL: Swift :: 1_stdlib/ReflectionHashing.swift (88 of 2415)
******************** TEST 'Swift :: 1_stdlib/ReflectionHashing.swift' FAILED ********************
Script:
--
/home/davide/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swiftc -target x86_64-unknown-linux-gnu  -module-cache-path '/tmp/swift-testsuite-clang-module-cache5Jq4Zn'   -module-name a /home/davide/swift/swift/test/1_stdlib/ReflectionHashing.swift -o /home/davide/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/test-linux-x86_64/1_stdlib/Output/ReflectionHashing.swift.tmp.out
/home/davide/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/test-linux-x86_64/1_stdlib/Output/ReflectionHashing.swift.tmp.out
--
Exit Code: 134

Command Output (stdout):
--
[ RUN      ] Reflection.Dictionary/Empty
[       OK ] Reflection.Dictionary/Empty
[ RUN      ] Reflection.Dictionary
out>>> check failed at /home/davide/swift/swift/test/1_stdlib/ReflectionHashing.swift, line 97
out>>> expected: "▿ 5 key/value pairs\n  ▿ [0]: (2 elements)\n    - .0: One\n    - .1: 1\n  ▿ [1]: (2 elements)\n    - .0: Five\n    - .1: 5\n  ▿ [2]: (2 elements)\n    - .0: Two\n    - .1: 2\n  ▿ [3]: (2 elements)\n    - .0: Four\n    - .1: 4\n  ▿ [4]: (2 elements)\n    - .0: Three\n    - .1: 3\n" (of type Swift.String)
out>>> actual: "▿ 5 key/value pairs\n  ▿ [0]: (2 elements)\n    - .0: One\n    - .1: 1\n  ▿ [1]: (2 elements)\n    - .0: Three\n    - .1: 3\n  ▿ [2]: (2 elements)\n    - .0: Four\n    - .1: 4\n  ▿ [3]: (2 elements)\n    - .0: Five\n    - .1: 5\n  ▿ [4]: (2 elements)\n    - .0: Two\n    - .1: 2\n" (of type Swift.String)
[     FAIL ] Reflection.Dictionary
[ RUN      ] Reflection.Set
[       OK ] Reflection.Set
Reflection: Some tests failed, aborting
UXPASS: []
FAIL: ["Dictionary"]
SKIP: []
To debug, run:
$ /home/davide/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/test-linux-x86_64/1_stdlib/Output/ReflectionHashing.swift.tmp.out --stdlib-unittest-in-process --stdlib-unittest-filter "Dictionary"

@dcci
Copy link
Member

dcci commented Jan 10, 2016

I'm not familiar with the internal of stdlib but the obvious culprit seems to be that the result of hashing is different.

@ezephir
Copy link
Author

ezephir commented Jan 10, 2016

@dcci That's exactly the culprit for why the original test failed before I extended it. I'll look into it.

@ezephir
Copy link
Author

ezephir commented Jan 10, 2016

Status update: Still looking at this. So far, no luck.

So far I've confirmed that it still works on my particular install of Ubuntu 14.04 with a full, non-incremental build. I've also explored language and locale settings, but I believe that the test runner filters these out and that stdlib ignores them for the purposes of hashing.

@ezephir
Copy link
Author

ezephir commented Jan 10, 2016

Status update: I've recently been able to reproduce the under Fedora 23. I'm still debugging the issue to see why the hashes are different.

@ezephir
Copy link
Author

ezephir commented Jan 10, 2016

@dcci I've reverted this change in PR #933 and have started a dialogue there on fixing it properly. Thank you for noticing this break and for your patience.

kateinoigakukun pushed a commit to kateinoigakukun/swift that referenced this pull request Sep 7, 2020
[pull] swiftwasm-release/5.3 from release/5.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants