forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '2.x' of https://github.com/opensearch-project/OpenSearch …
…into pits2.x
- Loading branch information
Showing
12 changed files
with
88 additions
and
5 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
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
45 changes: 45 additions & 0 deletions
45
buildSrc/src/test/java/org/opensearch/gradle/ArchitectureTests.java
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,45 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.gradle; | ||
|
||
import org.opensearch.gradle.test.GradleUnitTestCase; | ||
|
||
public class ArchitectureTests extends GradleUnitTestCase { | ||
|
||
final String architecture = System.getProperty("os.arch", ""); | ||
|
||
public void testCurrentArchitecture() { | ||
assertEquals(Architecture.X64, currentArchitecture("amd64")); | ||
assertEquals(Architecture.X64, currentArchitecture("x86_64")); | ||
assertEquals(Architecture.ARM64, currentArchitecture("aarch64")); | ||
assertEquals(Architecture.S390X, currentArchitecture("s390x")); | ||
} | ||
|
||
public void testInvalidCurrentArchitecture() { | ||
assertThrows("can not determine architecture from [", IllegalArgumentException.class, () -> currentArchitecture("fooBar64")); | ||
} | ||
|
||
/** | ||
* Determines the return value of {@link Architecture#current()} based on a string representing a potential OS Architecture. | ||
* | ||
* @param osArchToTest An expected value of the {@code os.arch} system property on another architecture. | ||
* @return the value of the {@link Architecture} enum which would have resulted with the given value. | ||
* @throws IllegalArgumentException if the string is not mapped to a value of the {@link Architecture} enum. | ||
*/ | ||
private Architecture currentArchitecture(String osArchToTest) throws IllegalArgumentException { | ||
// Test new architecture | ||
System.setProperty("os.arch", osArchToTest); | ||
try { | ||
return Architecture.current(); | ||
} finally { | ||
// Restore actual architecture property value | ||
System.setProperty("os.arch", this.architecture); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
// This file is intentionally blank. All configuration of the | ||
// export is done in the parent project. |
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