-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! Clean up any invalid group V1 ids in database.
- Loading branch information
1 parent
834c2c2
commit cce8cdc
Showing
4 changed files
with
58 additions
and
12 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
42 changes: 42 additions & 0 deletions
42
app/src/test/java/org/thoughtcrime/securesms/testutil/ZkGroupLibraryUtil.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,42 @@ | ||
package org.thoughtcrime.securesms.testutil; | ||
|
||
import org.signal.zkgroup.internal.Native; | ||
|
||
import static org.junit.Assert.assertNotNull; | ||
import static org.junit.Assert.fail; | ||
import static org.junit.Assume.assumeNoException; | ||
|
||
public final class ZkGroupLibraryUtil { | ||
|
||
private ZkGroupLibraryUtil() { | ||
} | ||
|
||
/** | ||
* Attempts to initialize the ZkGroup Native class, which will load the native binaries. | ||
* <p> | ||
* If that fails to link, then on Unix, it will fail as we rely on that for CI. | ||
* <p> | ||
* If that fails to link, and it's not Unix, it will skip the test via assumption violation. | ||
*/ | ||
public static void assumeZkGroupSupportedOnOS() { | ||
try { | ||
Class.forName(Native.class.getName()); | ||
} catch (ClassNotFoundException e) { | ||
fail(); | ||
} catch (UnsatisfiedLinkError | NoClassDefFoundError e) { | ||
String osName = System.getProperty("os.name"); | ||
|
||
if (isUnix(osName)) { | ||
fail("Not able to link native ZkGroup on a key OS: " + osName); | ||
} else { | ||
assumeNoException("Not able to link native ZkGroup on this operating system: " + osName, e); | ||
} | ||
} | ||
} | ||
|
||
private static boolean isUnix(String osName) { | ||
assertNotNull(osName); | ||
osName = osName.toLowerCase(); | ||
return osName.contains("nix") || osName.contains("nux") || osName.contains("aix"); | ||
} | ||
} |