Skip to content

Commit 2bbc2a5

Browse files
committed
Add instrumentation test for runtime API
1 parent fc844f6 commit 2bbc2a5

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
package org.pytorch.executorch;
10+
11+
import static org.junit.Assert.assertTrue;
12+
import static org.junit.Assert.assertNotNull;
13+
14+
import androidx.test.ext.junit.runners.AndroidJUnit4;
15+
import org.junit.runner.RunWith;
16+
import org.junit.Test;
17+
18+
/** Unit tests for {@link Runtime}. */
19+
@RunWith(AndroidJUnit4.class)
20+
public class RuntimeInstrumentationTest {
21+
22+
@Test
23+
public void testRuntimeApi() {
24+
assertTrue(Runtime.isInitialized());
25+
26+
String[] ops = Runtime.getRegisteredOps();
27+
String[] backends = Runtime.getRegisteredBackends();
28+
29+
assertNotNull(ops);
30+
assertNotNull(backends);
31+
32+
for (String op : ops) {
33+
assertNotNull(op);
34+
}
35+
36+
for (String backend : backends) {
37+
assertNotNull(backend);
38+
}
39+
}
40+
}

0 commit comments

Comments
 (0)