pytorch
701e05dc - Buck test targets robolectric,instrumentattion

Commit
6 years ago
Buck test targets robolectric,instrumentattion Summary: Buck targets for robolectric and instrumentation tests for pytorch android: ``` buck test fbsource//fbandroid/mode/server //xplat/caffe2/android:test_host ``` ``` buck test //xplat/caffe2/android:test_instrumentation ``` For both: ``` buck test fbsource//fbandroid/mode/server //xplat/caffe2/android:pytorch ``` Models in assets: `pt_android_test_asset` - creates buck target that can be included in both robolectric and instrumentation tests that contains asset created from provided torchscript sources as separate file, using the latest binaries of libtorch. `pt_gen_test_asset_bin` does that tacing, usage format ``` generate_test_asset input_file.jit output_file.py ``` Example of test-host setup for users of pytorch android: robolectric tests: ``` load("fbsource//xplat/caffe2:pt_defs.bzl", "pt_android_test_asset", "pt_predictor_binary", "PT_ANDRIOID_TEST_HOST_JNI_DEPS") pt_android_test_asset( name = "test_asset", src = "test_asset.jit", asset_name = "test_asset.pt", ) robolectric3_test( name = "example_test_host", srcs = [...], jni_deps = PT_ANDRIOID_TEST_HOST_JNI_DEPS, deps = [ ":pytorch_common", ":test_asset", "//fbandroid/java/com/facebook/soloader/annotation:annotation", "//fbandroid/java/com/facebook/testing/robolectric/v3:v3", "//fbandroid/libraries/soloader/java/com/facebook/soloader:soloader", "//fbandroid/third-party/java/robolectric3/robolectric:robolectric", ], ) ``` COMMON_LINKER_FLAGS = ["-Wl,--no-as-needed"] can not be applied on MacOs Test Plan: ``` [twsvcscm@od0187.atn1 /data/sandcastle/boxes/fbsource (b416b20a)]$ buck test fbsource//fbandroid/mode/server //xplat/caffe2/android:pytorch Parsing buck files: finished in 7.2 sec Creating action graph: finished in 0.7 sec Building: finished in 11.9 sec (100%) 791/791 jobs, 0 updated Total time: 19.9 sec Testing: finished in 11.0 sec (30 PASS/0 FAIL) RESULTS FOR //xplat/caffe2/android:test_host //xplat/caffe2/android:test_instrumentation PASS 159ms 15 Passed 0 Skipped 0 Failed org.pytorch.PytorchHostTests PASS 152ms 15 Passed 0 Skipped 0 Failed org.pytorch.PytorchInstrumentedTests (localhost:31930) TESTS PASSED ``` OSS changes test: ``` gradle -p android pytorch_android:cAT passes ``` Reviewed By: dreiss Differential Revision: D18799005 fbshipit-source-id: 881609826a837efebc8526aee40355c5a62947d0
Author
Parents
Loading