Skip to content
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

[SR-9985] TestNSNumber.test_descriptionWithLocale failing on Swift 5.0 AArch64 #3526

Closed
futurejones opened this issue Feb 23, 2019 · 25 comments

Comments

@futurejones
Copy link

Previous ID SR-9985
Radar None
Original Reporter @futurejones
Type Bug
Status Resolved
Resolution Done
Environment

Linux Ubuntu 16.04 LTS on AArch64

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee None
Priority Medium

md5: 5d44a74d8f8f63c16353924e5b1e3d3c

Issue Description:

In Swift 4.2.2 `TestNSNumber.test_descriptionWithLocale` passes.

Test Case 'TestNSNumber.test_descriptionWithLocale' started at 2019-02-06 01:42:36.492
 Test Case 'TestNSNumber.test_descriptionWithLocale' passed (0.001 seconds)

But in Swift 5.0 `TestNSNumber.test_descriptionWithLocale` fails.

Test Case 'TestNSNumber.test_descriptionWithLocale' started at 2019-02-23 05:20:56.122
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1105: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("1000") is not equal to ("1,000") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1110: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("-32768") is not equal to ("-32,768") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1111: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("32767") is not equal to ("32,767") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1112: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("-2147483648") is not equal to ("-2,147,483,648") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1113: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("2147483647") is not equal to ("2,147,483,647") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1114: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("-9223372036854775808") is not equal to ("-9,223,372,036,854,775,808") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1115: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("9223372036854775807") is not equal to ("9,223,372,036,854,775,807") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1120: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("65535") is not equal to ("65,535") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1122: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("4294967295") is not equal to ("4,294,967,295") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1130: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("1e+09") is not equal to ("1E+09") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1133: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("nan") is not equal to ("NaN") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1134: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("1.175494e-38") is not equal to ("1.175494E-38") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1135: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("1.401298e-45") is not equal to ("1.401298E-45") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1136: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("3.402823e+38") is not equal to ("3.402823E+38") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1140: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("1000000000") is not equal to ("1,000,000,000") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1143: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("nan") is not equal to ("NaN") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1150: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("1000") is not equal to ("1.000") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1155: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("-32768") is not equal to ("-32.768") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1156: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("32767") is not equal to ("32.767") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1157: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("-2147483648") is not equal to ("-2.147.483.648") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1158: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("2147483647") is not equal to ("2.147.483.647") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1159: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("-9223372036854775808") is not equal to ("-9.223.372.036.854.775.808") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1160: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("9223372036854775807") is not equal to ("9.223.372.036.854.775.807") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1165: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("65535") is not equal to ("65.535") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1167: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("4294967295") is not equal to ("4.294.967.295") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1175: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("1e+09") is not equal to ("1E+09") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1179: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("nan") is not equal to ("NaN") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1180: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("1,175494e-38") is not equal to ("1,175494E-38") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1181: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("1,401298e-45") is not equal to ("1,401298E-45") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1182: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("3,402823e+38") is not equal to ("3,402823E+38") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1185: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("1000000000") is not equal to ("1.000.000.000") - 
 /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:1188: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("nan") is not equal to ("NaN") - 
 Test Case 'TestNSNumber.test_descriptionWithLocale' failed (0.008 seconds)
@spevans
Copy link
Collaborator

spevans commented Feb 23, 2019

What version of ICU are you using? Is it building it as part of the swift build?

@futurejones
Copy link
Author

As far as I can see it is version ICU4C and it is part of the swift build.

@spevans
Copy link
Collaborator

spevans commented Feb 23, 2019

Could you try merging #1866 into your master branch to see if it passes - It checks the ICU version >= 61

Also, could you test if the latest swift-4.2-branch still builds and tests ok, as this fix #1929 was added as a potential fix for 4.2.3 so it may need to be reverted.

@futurejones
Copy link
Author

Tested new build of swift-4.2-branch and

TestNSNumber.test_descriptionWithLocale

is now failing.

Test Case 'TestNSNumber.test_descriptionWithLocale' started at 2019-02-23 13:16:22.710

TestFoundation/TestNSNumber.swift:1104: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("1000") is not equal to ("1,000") - 

TestFoundation/TestNSNumber.swift:1109: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("-32768") is not equal to ("-32,768") - 

TestFoundation/TestNSNumber.swift:1110: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("32767") is not equal to ("32,767") - 

TestFoundation/TestNSNumber.swift:1111: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("-2147483648") is not equal to ("-2,147,483,648") - 

TestFoundation/TestNSNumber.swift:1112: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("2147483647") is not equal to ("2,147,483,647") - 

TestFoundation/TestNSNumber.swift:1113: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("-9223372036854775808") is not equal to ("-9,223,372,036,854,775,808") - 

TestFoundation/TestNSNumber.swift:1114: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("9223372036854775807") is not equal to ("9,223,372,036,854,775,807") - 

TestFoundation/TestNSNumber.swift:1119: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("65535") is not equal to ("65,535") - 

TestFoundation/TestNSNumber.swift:1121: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("4294967295") is not equal to ("4,294,967,295") - 

TestFoundation/TestNSNumber.swift:1129: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("1e+09") is not equal to ("1E+09") - 

TestFoundation/TestNSNumber.swift:1132: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("nan") is not equal to ("NaN") - 

TestFoundation/TestNSNumber.swift:1133: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("1.175494e-38") is not equal to ("1.175494E-38") - 

TestFoundation/TestNSNumber.swift:1134: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("1.401298e-45") is not equal to ("1.401298E-45") - 

TestFoundation/TestNSNumber.swift:1135: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("3.402823e+38") is not equal to ("3.402823E+38") - 

TestFoundation/TestNSNumber.swift:1139: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("1000000000") is not equal to ("1,000,000,000") - 

TestFoundation/TestNSNumber.swift:1142: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("nan") is not equal to ("NaN") - 

TestFoundation/TestNSNumber.swift:1149: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("1000") is not equal to ("1.000") - 

TestFoundation/TestNSNumber.swift:1154: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("-32768") is not equal to ("-32.768") - 

TestFoundation/TestNSNumber.swift:1155: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("32767") is not equal to ("32.767") - 

TestFoundation/TestNSNumber.swift:1156: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("-2147483648") is not equal to ("-2.147.483.648") - 

TestFoundation/TestNSNumber.swift:1157: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("2147483647") is not equal to ("2.147.483.647") - 

TestFoundation/TestNSNumber.swift:1158: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("-9223372036854775808") is not equal to ("-9.223.372.036.854.775.808") - 

TestFoundation/TestNSNumber.swift:1159: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("9223372036854775807") is not equal to ("9.223.372.036.854.775.807") - 

TestFoundation/TestNSNumber.swift:1164: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("65535") is not equal to ("65.535") - 

TestFoundation/TestNSNumber.swift:1166: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("4294967295") is not equal to ("4.294.967.295") - 

TestFoundation/TestNSNumber.swift:1174: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("1e+09") is not equal to ("1E+09") - 

TestFoundation/TestNSNumber.swift:1178: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("nan") is not equal to ("NaN") - 

TestFoundation/TestNSNumber.swift:1179: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("1,175494e-38") is not equal to ("1,175494E-38") - 

TestFoundation/TestNSNumber.swift:1180: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("1,401298e-45") is not equal to ("1,401298E-45") - 

TestFoundation/TestNSNumber.swift:1181: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("3,402823e+38") is not equal to ("3,402823E+38") - 

TestFoundation/TestNSNumber.swift:1184: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("1000000000") is not equal to ("1.000.000.000") - 

TestFoundation/TestNSNumber.swift:1187: error: TestNSNumber.test_descriptionWithLocale : XCTAssertEqual failed: ("nan") is not equal to ("NaN") - 

Test Case 'TestNSNumber.test_descriptionWithLocale' failed (0.008 seconds)

Also this is failing

Test Case 'TestNSString.test_initializeWithFormat3' started at 2019-02-23 13:16:26.238
TestFoundation/TestNSString.swift:838: error: TestNSString.test_initializeWithFormat3 : XCTAssertEqual failed: ("en_GB value is 1000 (42.0)") is not equal to ("en_GB value is 1,000 (42.0)") - 
TestFoundation/TestNSString.swift:844: error: TestNSString.test_initializeWithFormat3 : XCTAssertEqual failed: ("de_DE value is 1000 (42,0)") is not equal to ("de_DE value is 1.000 (42,0)") - 
Test Case 'TestNSString.test_initializeWithFormat3' failed (0.001 seconds)

@futurejones
Copy link
Author

Build on master with PR #1866 is running now.

@futurejones
Copy link
Author

All tests are passing on the master 😃 with PR #1866

--- Running tests for foundation ---
--- test ---
+ /usr/local/bin/cmake --build /home/worksonarm_test/jenkins_slave/workspace/swift-master-aarch64-test/build/buildbot_linux/foundation-linux-aarch64 -- -j96 test
[0/1][  0%][0.000s] Running tests...
Test project /home/worksonarm_test/jenkins_slave/workspace/swift-master-aarch64-test/build/buildbot_linux/foundation-linux-aarch64
    Start 1: TestFoundation
1/1 Test #​1: TestFoundation ...................   Passed   45.67 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) =  45.68 sec
-- test finished --
--- Finished tests for foundation ---

@spevans
Copy link
Collaborator

spevans commented Feb 23, 2019

What about the swift-5.0-branch with that PR? I dont think there should be any differences between 5.0 and master wrt this change.

@futurejones
Copy link
Author

Tested swift-5.0-branch with PR #1866 and 'TestNSNumber.test_descriptionWithLocale' and 'TestNSString.test_initializeWithFormat3' are still failing.

@spevans
Copy link
Collaborator

spevans commented Feb 24, 2019

There isnt any difference between master and 5.0 for this code change so Im not sure why it is failing.

What build command are you using? Is it using the same build command for both?

That PR just checks ICU is a minimum version, which it satisfies.

@futurejones
Copy link
Author

Both builds are identical clean builds using the [preset: buildbot_linux]
I will try another fresh build tomorrow.

@futurejones
Copy link
Author

I have run foundation tests on new clean builds 2019-02-25 and the results are as follows:-

swift-4.2-branch

  • 'TestNSNumber.test_descriptionWithLocale' and 'TestNSString.test_initializeWithFormat3' are now failing.

swift-5.0-branch - with PR #1866

  • 'TestNSNumber.test_descriptionWithLocale' and 'TestNSString.test_initializeWithFormat3' are still failing.

master - with PR #1866

  • 'TestNSNumber.test_descriptionWithLocale' and 'TestNSString.test_initializeWithFormat3' all tests passing.

@spevans
Copy link
Collaborator

spevans commented Feb 26, 2019

I think this may actually be a Locale issue since it seems all of the failing tests have the decimalSeparator and groupingSeparator missing for en_GB and de_DE.

Could you try running the following test against all three versions, for comparison this is what I see on x86_64 Ubuntu18.04:

$ cat locale.swift
import Foundation

print("current locale:", Locale.current.identifier)
print("decimalSeparator:", Locale.current.decimalSeparator ?? "nil")
print("groupingSeparator:", Locale.current.groupingSeparator ?? "nil")
print(String(format: "%d", locale: Locale.current, 123456))
print(String(format: "%0.7g\n", locale: Locale.current, 1234.5678))

let en = Locale(identifier: "en_GB")
print("EN locale:", en.identifier)
print("EN decimalSeparator:", en.decimalSeparator ?? "nil")
print("EN groupingSeparator:", en.groupingSeparator ?? "nil")
print(String(format: "%d", locale: en, 123456))
print(String(format: "%0.7g\n", locale: en, 1234.5678))

let de = Locale(identifier: "de_DE")
print("DE locale:", de.identifier)
print("DE decimalSeparator:", de.decimalSeparator ?? "nil")
print("DE groupingSeparator:", de.groupingSeparator ?? "nil")
print(String(format: "%d", locale: de, 123456))
print(String(format: "%0.7g\n", locale: de, 1234.5678))
$ ~/swift-4.2.2-RELEASE-ubuntu18.04/usr/bin/swift locale.swift
current locale: en_US
decimalSeparator: .
groupingSeparator: ,
123456
1234.568

EN locale: en_GB
EN decimalSeparator: .
EN groupingSeparator: ,
123456
1234.568

DE locale: de_DE
DE decimalSeparator: ,
DE groupingSeparator: .
123456
1234,568

$ ~/swift-5.0-DEVELOPMENT-SNAPSHOT-2019-02-19-a-ubuntu18.04/usr/bin/swift locale.swift
current locale: en_US
decimalSeparator: .
groupingSeparator: ,
123,456
1,234.568

EN locale: en_GB
EN decimalSeparator: .
EN groupingSeparator: ,
123,456
1,234.568

DE locale: de_DE
DE decimalSeparator: ,
DE groupingSeparator: .
123.456
1.234,568

$ ~/swift-DEVELOPMENT-SNAPSHOT-2019-02-19-a-ubuntu18.04/usr/bin/swift locale.swift
current locale: en_US
decimalSeparator: .
groupingSeparator: ,
123,456
1,234.568

EN locale: en_GB
EN decimalSeparator: .
EN groupingSeparator: ,
123,456
1,234.568

DE locale: de_DE
DE decimalSeparator: ,
DE groupingSeparator: .
123.456
1.234,568

Here, 4.2.2 doesn't use the Locale for some reason but 5.0 and master both match

@futurejones
Copy link
Author

[UPDATED]I am not seeing the same results on Ubuntu 16.04 AArch64
5.0 and master are different.

neil@swiftyarm:~$ /home/worksonarm_test/jenkins_slave/workspace/swift-4.2-aarch64-RELEASE/install/usr/bin/swift locale.swift 
current locale: en_US
decimalSeparator: .
groupingSeparator: ,
123456
1234.568


EN locale: en_GB
EN decimalSeparator: .
EN groupingSeparator: ,
123456
1234.568


DE locale: de_DE
DE decimalSeparator: ,
DE groupingSeparator: .
123456
1234,568


neil@swiftyarm:~$ /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64-test/install/usr/bin/swift locale.swift 
current locale: en_US
decimalSeparator: .
groupingSeparator: ,
123456
1234.568


EN locale: en_GB
EN decimalSeparator: .
EN groupingSeparator: ,
123456
1234.568


DE locale: de_DE
DE decimalSeparator: ,
DE groupingSeparator: .
123456
1234,568


neil@swiftyarm:~$ /home/worksonarm_test/jenkins_slave/workspace/swift-master-aarch64/install/usr/bin/swift locale.swift 
current locale: en_US
decimalSeparator: .
groupingSeparator: ,
123,456
1,234.568


EN locale: en_GB
EN decimalSeparator: .
EN groupingSeparator: ,
123,456
1,234.568


DE locale: de_DE
DE decimalSeparator: ,
DE groupingSeparator: .
123.456
1.234,568

@spevans
Copy link
Collaborator

spevans commented Feb 26, 2019

What happens if you run

import Foundation

let en = Locale(identifier: "en_GB")
print(String(format: "%d", locale: en, 123456))
print(String(format: "%0.7g\n", locale: en, 1234.5678))

let de = Locale(identifier: "de_DE")
print(String(format: "%d", locale: de, 123456))
print(String(format: "%0.7g\n", locale: de, 1234.5678)) 

since that is the function used by the .description(withLocale:)

@futurejones
Copy link
Author

Here are the results -
swift-5.0-aarch64-test = patched with PR #1866
swift-5.0-aarch64 = no patch

neil@swiftyarm:~$ /home/worksonarm_test/jenkins_slave/workspace/swift-4.2-aarch64-RELEASE/install/usr/bin/swift locale2.swift 
123456
1234.568

123456
1234,568

neil@swiftyarm:~$ /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64-test/install/usr/bin/swift locale2.swift 
123456
1234.568

123456
1234,568

neil@swiftyarm:~$ /home/worksonarm_test/jenkins_slave/workspace/swift-master-aarch64/install/usr/bin/swift locale2.swift 
123,456
1,234.568

123.456
1.234,568

neil@swiftyarm:~$ /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64/install/usr/bin/swift locale2.swift 
123456
1234.568

123456
1234,568

@spevans
Copy link
Collaborator

spevans commented Feb 26, 2019

I have another PR for you to try: it #1897

I believe on ARM64, char is unsigned by default on Linux and I think this is causing the localisation code to be disabled. This PR is merged into the master branch but not the 5.0 branch yet so could (hopefully) explain the difference as to why it is broken on ARM and not x86_64.

This PR should get merged into 5.0 at some point anyway but it would be good to get confirmation either way.

@futurejones
Copy link
Author

New build of swift-5.0-branch with PR #1897 - all tests passing 👍

— Running tests for foundation —
 --- test —
 + /usr/local/bin/cmake --build /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64-test/build/buildbot_linux/foundation-linux-aarch64 – -j96 test
 [0/1] Running tests...
 Test project /home/worksonarm_test/jenkins_slave/workspace/swift-5.0-aarch64-test/build/buildbot_linux/foundation-linux-aarch64
 Start 1: TestFoundation
 1/1 Test #​1: TestFoundation ................... Passed 42.41 sec
100% tests passed, 0 tests failed out of 1
Total Test time (real) = 42.42 sec
 – test finished –
 — Finished tests for foundation —

@spevans
Copy link
Collaborator

spevans commented Feb 27, 2019

That's good. As one final test could you un-revert the description change to the 4.2 branch and apply #1897 as well and see if thats all working there. Im guessing it will fix it.

Also, are you using a 96core ARM server?

@futurejones
Copy link
Author

I will try those changes later tonight.

Yes, 96cores. It's a Cavium ThunderX from https://www.packet.com/cloud/servers/c1-large-arm/

@futurejones
Copy link
Author

Un-reverted the description change to the 4.2 branch and applied #1897 - Tests now passing.

Test Case 'TestNSNumber.test_descriptionWithLocale' started at 2019-02-27 08:37:02.983
Test Case 'TestNSNumber.test_descriptionWithLocale' passed (0.01 seconds)
Test Case 'TestNSString.test_initializeWithFormat3' started at 2019-02-27 08:37:06.468
Test Case 'TestNSString.test_initializeWithFormat3' passed (0.001 seconds)

There are still 2 failing tests on 4.2-branch - This has been reported in https://bugs.swift.org/browse/SR-8263

Test Case 'TestNSNumberBridging.testNSNumberBridgeFromInt32' started at 2019-02-27 08:37:03.004
TestFoundation/TestNSNumberBridging.swift:41: error: TestNSNumberBridging.testNSNumberBridgeFromInt32 : failed - TestFoundation/TestNSNumberBridging.swift:235 Optional(2.1474836e+09) != nil Float
TestFoundation/TestNSNumberBridging.swift:41: error: TestNSNumberBridging.testNSNumberBridgeFromInt32 : failed - TestFoundation/TestNSNumberBridging.swift:235 Optional(2.1474836e+09) != nil Float
Test Case 'TestNSNumberBridging.testNSNumberBridgeFromInt32' failed (0.004 seconds)
Test Case 'TestNSNumberBridging.testNSNumberBridgeFromUInt32' started at 2019-02-27 08:37:03.008
TestFoundation/TestNSNumberBridging.swift:41: error: TestNSNumberBridging.testNSNumberBridgeFromUInt32 : failed - TestFoundation/TestNSNumberBridging.swift:274 Optional(4.2949673e+09) != nil Float
TestFoundation/TestNSNumberBridging.swift:41: error: TestNSNumberBridging.testNSNumberBridgeFromUInt32 : failed - TestFoundation/TestNSNumberBridging.swift:274 Optional(4.2949673e+09) != nil Float
Test Case 'TestNSNumberBridging.testNSNumberBridgeFromUInt32' failed (0.002 seconds)

5.0-branch (with #1897) and master are 100% passing.

@spevans
Copy link
Collaborator

spevans commented Feb 27, 2019

So do these two failing tests fail on the current 4.2.2 branch or just the HEAD of swift-4.2-branch ?

@futurejones
Copy link
Author

They have been failing since 4.1 maybe before.

@spevans
Copy link
Collaborator

spevans commented Mar 6, 2019

This has been remerged back into the 4.2 branch along with the #1897 fix, could you retest the branch and update this bug when you have a chance? I think it should be fixed for both 4.2 and 5.0 branches now.

@futurejones
Copy link
Author

@spevans I have retested and can confirm that this bug is fixed on all branches.

@futurejones
Copy link
Author

swift-5.0-branch fixed with PR #1897
#1897

swift-4.2-branch fixed with PR #1972
#1972

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants