This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change LC_NUMERIC for CentOS CI jobs to verify locale invariance (#18097
) * Load the user's locale before performing tests * Change the locale for the CentOS CI jobs to weed out locale-related bugs * Mark tests that fail due to the decimal point with xfail * Run localedef when generating the CentOS CI image * Cancel some Scala tests when C locale uses a non-standard decimal sep. * Rename xfail helper to xfail_when_nonstandard_decimal_separator * Fix scalastyle errors * Disable more Python tests that fail due to locale-related issues * Move assumeStandardDecimalSeparator into separate object to fix scaladoc * Disable the "symbol pow" test when running with non-standard decimal sep * Disable new tests that fail due to locale-related issues
- Loading branch information
1 parent
f00b9ab
commit eab068b
Showing
26 changed files
with
152 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
scala-package/core/src/test/scala/org/apache/mxnet/CancelTestUtil.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.mxnet | ||
|
||
import java.text.DecimalFormatSymbols | ||
import java.util.Locale | ||
|
||
import org.scalatest.Assertions | ||
|
||
object CancelTestUtil { | ||
/** | ||
* Cancel the test if the system's locale uses a decimal separator other than '.'. Please see | ||
* #18097 for more information. | ||
*/ | ||
def assumeStandardDecimalSeparator(): Unit = { | ||
val lcNumeric = System.getenv("LC_NUMERIC"); | ||
|
||
val decimalFormatSymbols = if (lcNumeric != null) { | ||
val localeName = lcNumeric.stripSuffix(".UTF-8".stripSuffix(".utf-8")) | ||
val locale = Locale.forLanguageTag(localeName) | ||
DecimalFormatSymbols.getInstance(locale) | ||
} else { | ||
DecimalFormatSymbols.getInstance() | ||
} | ||
|
||
val isStandardDecimalPoint = (decimalFormatSymbols.getDecimalSeparator == '.') && | ||
(lcNumeric != null && lcNumeric.toLowerCase != "en_dk.utf-8") // Java doesn't seem to respect | ||
// the decimal separator | ||
// set in en_DK.UTF8, which is | ||
// used in CentOS CI jobs. | ||
if (!isStandardDecimalPoint) { | ||
Assertions.cancel("Some operators " + | ||
"break when the decimal separator is set to anything other than \".\". These operators " + | ||
"should be rewritten to utilize the new FFI. Please see #18097 for more information.") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.