riscv64: disable gtests for unsupported components.

Bug: b/271573990

Test: gtests on host:
  lunch aosp_riscv64-userdebug && m test-art-host-gtest

Test: gtests on target (on a Linux RISC-V VM):
  lunch aosp_riscv64-userdebug

  export ART_TEST_SSH_USER=ubuntu
  export ART_TEST_SSH_HOST=localhost
  export ART_TEST_SSH_PORT=10001
  export ART_TEST_ON_VM=true

  . art/tools/buildbot-utils.sh
  art/tools/buildbot-build.sh --target

  # Create, boot and configure the VM.
  art/tools/buildbot-vm.sh create
  art/tools/buildbot-vm.sh boot
  art/tools/buildbot-vm.sh setup-ssh  # password: 'ubuntu'

  art/tools/buildbot-cleanup-device.sh
  art/tools/buildbot-setup-device.sh
  art/tools/buildbot-sync.sh

  art/tools/run-gtests.sh

Change-Id: I278e3453406a91a5e9d03645cafb9a9d1f82d896
diff --git a/compiler/compiler_reflection_test.cc b/compiler/compiler_reflection_test.cc
index f3c07db..d8e2b9e 100644
--- a/compiler/compiler_reflection_test.cc
+++ b/compiler/compiler_reflection_test.cc
@@ -29,6 +29,7 @@
 class CompilerReflectionTest : public CommonCompilerTest {};
 
 TEST_F(CompilerReflectionTest, StaticMainMethod) {
+  TEST_DISABLED_FOR_RISCV64();
   ScopedObjectAccess soa(Thread::Current());
   jobject jclass_loader = LoadDex("Main");
   StackHandleScope<1> hs(soa.Self());
diff --git a/compiler/jni/jni_compiler_test.cc b/compiler/jni/jni_compiler_test.cc
index 397db25..2fd7a6b 100644
--- a/compiler/jni/jni_compiler_test.cc
+++ b/compiler/jni/jni_compiler_test.cc
@@ -447,12 +447,14 @@
 // 1) synchronized keyword
 # define JNI_TEST_NORMAL_ONLY(TestName)          \
   TEST_F(JniCompilerTest, TestName ## NormalCompiler) { \
+    TEST_DISABLED_FOR_RISCV64(); \
     ScopedCheckHandleScope top_handle_scope_check;  \
     SCOPED_TRACE("Normal JNI with compiler");    \
     gCurrentJni = static_cast<uint32_t>(JniKind::kNormal); \
     TestName ## Impl();                          \
   }                                              \
   TEST_F(JniCompilerTest, TestName ## NormalGeneric) { \
+    TEST_DISABLED_FOR_RISCV64(); \
     ScopedCheckHandleScope top_handle_scope_check;  \
     SCOPED_TRACE("Normal JNI with generic");     \
     gCurrentJni = static_cast<uint32_t>(JniKind::kNormal); \
@@ -464,6 +466,7 @@
 #define JNI_TEST(TestName) \
   JNI_TEST_NORMAL_ONLY(TestName)                 \
   TEST_F(JniCompilerTest, TestName ## FastCompiler) {    \
+    TEST_DISABLED_FOR_RISCV64(); \
     ScopedCheckHandleScope top_handle_scope_check;  \
     SCOPED_TRACE("@FastNative JNI with compiler");  \
     gCurrentJni = static_cast<uint32_t>(JniKind::kFast); \
@@ -471,6 +474,7 @@
   }                                              \
                                                  \
   TEST_F(JniCompilerTest, TestName ## FastGeneric) { \
+    TEST_DISABLED_FOR_RISCV64(); \
     ScopedCheckHandleScope top_handle_scope_check;  \
     SCOPED_TRACE("@FastNative JNI with generic");  \
     gCurrentJni = static_cast<uint32_t>(JniKind::kFast); \
@@ -481,12 +485,14 @@
 // Test (@CriticalNative) x (compiler, generic) only.
 #define JNI_TEST_CRITICAL_ONLY(TestName) \
   TEST_F(JniCompilerTest, TestName ## CriticalCompiler) { \
+    TEST_DISABLED_FOR_RISCV64(); \
     ScopedCheckHandleScope top_handle_scope_check;  \
     SCOPED_TRACE("@CriticalNative JNI with compiler");  \
     gCurrentJni = static_cast<uint32_t>(JniKind::kCritical); \
     TestName ## Impl();                          \
   }                                              \
   TEST_F(JniCompilerTest, TestName ## CriticalGeneric) { \
+    TEST_DISABLED_FOR_RISCV64(); \
     ScopedCheckHandleScope top_handle_scope_check;  \
     SCOPED_TRACE("@CriticalNative JNI with generic");  \
     gCurrentJni = static_cast<uint32_t>(JniKind::kCritical); \
diff --git a/compiler/optimizing/linearize_test.cc b/compiler/optimizing/linearize_test.cc
index 01daa23..6f4f2b6 100644
--- a/compiler/optimizing/linearize_test.cc
+++ b/compiler/optimizing/linearize_test.cc
@@ -55,6 +55,7 @@
 }
 
 TEST_F(LinearizeTest, CFG1) {
+  TEST_DISABLED_FOR_RISCV64();
   // Structure of this graph (+ are back edges)
   //            Block0
   //              |
@@ -80,6 +81,7 @@
 }
 
 TEST_F(LinearizeTest, CFG2) {
+  TEST_DISABLED_FOR_RISCV64();
   // Structure of this graph (+ are back edges)
   //            Block0
   //              |
@@ -105,6 +107,7 @@
 }
 
 TEST_F(LinearizeTest, CFG3) {
+  TEST_DISABLED_FOR_RISCV64();
   // Structure of this graph (+ are back edges)
   //            Block0
   //              |
@@ -132,6 +135,7 @@
 }
 
 TEST_F(LinearizeTest, CFG4) {
+  TEST_DISABLED_FOR_RISCV64();
   /* Structure of this graph (+ are back edges)
   //            Block0
   //              |
@@ -162,6 +166,7 @@
 }
 
 TEST_F(LinearizeTest, CFG5) {
+  TEST_DISABLED_FOR_RISCV64();
   /* Structure of this graph (+ are back edges)
   //            Block0
   //              |
@@ -192,6 +197,7 @@
 }
 
 TEST_F(LinearizeTest, CFG6) {
+  TEST_DISABLED_FOR_RISCV64();
   //            Block0
   //              |
   //            Block1
@@ -218,6 +224,7 @@
 }
 
 TEST_F(LinearizeTest, CFG7) {
+  TEST_DISABLED_FOR_RISCV64();
   // Structure of this graph (+ are back edges)
   //            Block0
   //              |
diff --git a/compiler/optimizing/live_ranges_test.cc b/compiler/optimizing/live_ranges_test.cc
index fb1a23e..7e488ba 100644
--- a/compiler/optimizing/live_ranges_test.cc
+++ b/compiler/optimizing/live_ranges_test.cc
@@ -47,6 +47,7 @@
 }
 
 TEST_F(LiveRangesTest, CFG1) {
+  TEST_DISABLED_FOR_RISCV64();
   /*
    * Test the following snippet:
    *  return 0;
@@ -81,6 +82,7 @@
 }
 
 TEST_F(LiveRangesTest, CFG2) {
+  TEST_DISABLED_FOR_RISCV64();
   /*
    * Test the following snippet:
    *  var a = 0;
@@ -125,6 +127,7 @@
 }
 
 TEST_F(LiveRangesTest, CFG3) {
+  TEST_DISABLED_FOR_RISCV64();
   /*
    * Test the following snippet:
    *  var a = 0;
@@ -194,6 +197,7 @@
 }
 
 TEST_F(LiveRangesTest, Loop1) {
+  TEST_DISABLED_FOR_RISCV64();
   /*
    * Test the following snippet:
    *  var a = 0;
@@ -270,6 +274,7 @@
 }
 
 TEST_F(LiveRangesTest, Loop2) {
+  TEST_DISABLED_FOR_RISCV64();
   /*
    * Test the following snippet:
    *  var a = 0;
@@ -341,6 +346,7 @@
 }
 
 TEST_F(LiveRangesTest, CFG4) {
+  TEST_DISABLED_FOR_RISCV64();
   /*
    * Test the following snippet:
    *  var a = 0;
diff --git a/compiler/optimizing/liveness_test.cc b/compiler/optimizing/liveness_test.cc
index 0b421cf..6af07ae 100644
--- a/compiler/optimizing/liveness_test.cc
+++ b/compiler/optimizing/liveness_test.cc
@@ -70,6 +70,7 @@
 }
 
 TEST_F(LivenessTest, CFG1) {
+  TEST_DISABLED_FOR_RISCV64();
   const char* expected =
     "Block 0\n"
     "  live in: (0)\n"
@@ -93,6 +94,7 @@
 }
 
 TEST_F(LivenessTest, CFG2) {
+  TEST_DISABLED_FOR_RISCV64();
   const char* expected =
     "Block 0\n"
     "  live in: (0)\n"
@@ -115,6 +117,7 @@
 }
 
 TEST_F(LivenessTest, CFG3) {
+  TEST_DISABLED_FOR_RISCV64();
   const char* expected =
     "Block 0\n"  // entry block
     "  live in: (000)\n"
@@ -144,6 +147,7 @@
 }
 
 TEST_F(LivenessTest, CFG4) {
+  TEST_DISABLED_FOR_RISCV64();
   // var a;
   // if (0 == 0) {
   //   a = 5;
@@ -192,6 +196,7 @@
 }
 
 TEST_F(LivenessTest, CFG5) {
+  TEST_DISABLED_FOR_RISCV64();
   // var a = 0;
   // if (0 == 0) {
   // } else {
@@ -237,6 +242,7 @@
 }
 
 TEST_F(LivenessTest, Loop1) {
+  TEST_DISABLED_FOR_RISCV64();
   // Simple loop with one preheader and one back edge.
   // var a = 0;
   // while (a == a) {
@@ -283,6 +289,7 @@
 }
 
 TEST_F(LivenessTest, Loop3) {
+  TEST_DISABLED_FOR_RISCV64();
   // Test that the returned value stays live in a preceding loop.
   // var a = 0;
   // while (a == a) {
@@ -330,6 +337,7 @@
 
 
 TEST_F(LivenessTest, Loop4) {
+  TEST_DISABLED_FOR_RISCV64();
   // Make sure we support a preheader of a loop not being the first predecessor
   // in the predecessor list of the header.
   // var a = 0;
@@ -382,6 +390,7 @@
 }
 
 TEST_F(LivenessTest, Loop5) {
+  TEST_DISABLED_FOR_RISCV64();
   // Make sure we create a preheader of a loop when a header originally has two
   // incoming blocks and one back edge.
   // Bitsets are made of:
@@ -438,6 +447,7 @@
 }
 
 TEST_F(LivenessTest, Loop6) {
+  TEST_DISABLED_FOR_RISCV64();
   // Bitsets are made of:
   // (constant0, constant4, constant5, phi in block 2)
   const char* expected =
@@ -489,6 +499,7 @@
 
 
 TEST_F(LivenessTest, Loop7) {
+  TEST_DISABLED_FOR_RISCV64();
   // Bitsets are made of:
   // (constant0, constant4, constant5, phi in block 2, phi in block 6)
   const char* expected =
@@ -543,6 +554,7 @@
 }
 
 TEST_F(LivenessTest, Loop8) {
+  TEST_DISABLED_FOR_RISCV64();
   // var a = 0;
   // while (a == a) {
   //   a = a + a;
diff --git a/compiler/optimizing/loop_optimization_test.cc b/compiler/optimizing/loop_optimization_test.cc
index 7f694fb..49e3c04 100644
--- a/compiler/optimizing/loop_optimization_test.cc
+++ b/compiler/optimizing/loop_optimization_test.cc
@@ -30,6 +30,7 @@
 class LoopOptimizationTest : public OptimizingUnitTest {
  protected:
   void SetUp() override {
+    TEST_SETUP_DISABLED_FOR_RISCV64();
     OptimizingUnitTest::SetUp();
 
     graph_ = CreateGraph();
@@ -44,6 +45,7 @@
   }
 
   void TearDown() override {
+    TEST_TEARDOWN_DISABLED_FOR_RISCV64();
     codegen_.reset();
     compiler_options_.reset();
     graph_ = nullptr;
@@ -134,17 +136,20 @@
 //
 
 TEST_F(LoopOptimizationTest, NoLoops) {
+  TEST_DISABLED_FOR_RISCV64();
   PerformAnalysis();
   EXPECT_EQ("", LoopStructure());
 }
 
 TEST_F(LoopOptimizationTest, SingleLoop) {
+  TEST_DISABLED_FOR_RISCV64();
   AddLoop(entry_block_, return_block_);
   PerformAnalysis();
   EXPECT_EQ("[]", LoopStructure());
 }
 
 TEST_F(LoopOptimizationTest, LoopNest10) {
+  TEST_DISABLED_FOR_RISCV64();
   HBasicBlock* b = entry_block_;
   HBasicBlock* s = return_block_;
   for (int i = 0; i < 10; i++) {
@@ -156,6 +161,7 @@
 }
 
 TEST_F(LoopOptimizationTest, LoopSequence10) {
+  TEST_DISABLED_FOR_RISCV64();
   HBasicBlock* b = entry_block_;
   HBasicBlock* s = return_block_;
   for (int i = 0; i < 10; i++) {
@@ -167,6 +173,7 @@
 }
 
 TEST_F(LoopOptimizationTest, LoopSequenceOfNests) {
+  TEST_DISABLED_FOR_RISCV64();
   HBasicBlock* b = entry_block_;
   HBasicBlock* s = return_block_;
   for (int i = 0; i < 10; i++) {
@@ -194,6 +201,7 @@
 }
 
 TEST_F(LoopOptimizationTest, LoopNestWithSequence) {
+  TEST_DISABLED_FOR_RISCV64();
   HBasicBlock* b = entry_block_;
   HBasicBlock* s = return_block_;
   for (int i = 0; i < 10; i++) {
@@ -215,6 +223,7 @@
 //
 // This is a test for nodes.cc functionality - HGraph::SimplifyLoop.
 TEST_F(LoopOptimizationTest, SimplifyLoopReoderPredecessors) {
+  TEST_DISABLED_FOR_RISCV64();
   // Can't use AddLoop as we want special order for blocks predecessors.
   HBasicBlock* header = new (GetAllocator()) HBasicBlock(graph_);
   HBasicBlock* body = new (GetAllocator()) HBasicBlock(graph_);
@@ -260,6 +269,7 @@
 //
 // This is a test for nodes.cc functionality - HGraph::SimplifyLoop.
 TEST_F(LoopOptimizationTest, SimplifyLoopSinglePreheader) {
+  TEST_DISABLED_FOR_RISCV64();
   HBasicBlock* header = AddLoop(entry_block_, return_block_);
 
   header->InsertInstructionBefore(
diff --git a/compiler/optimizing/ssa_liveness_analysis_test.cc b/compiler/optimizing/ssa_liveness_analysis_test.cc
index 2df0f34..18c94538 100644
--- a/compiler/optimizing/ssa_liveness_analysis_test.cc
+++ b/compiler/optimizing/ssa_liveness_analysis_test.cc
@@ -31,6 +31,7 @@
 class SsaLivenessAnalysisTest : public OptimizingUnitTest {
  protected:
   void SetUp() override {
+    TEST_SETUP_DISABLED_FOR_RISCV64();
     OptimizingUnitTest::SetUp();
     graph_ = CreateGraph();
     compiler_options_ = CommonCompilerTest::CreateCompilerOptions(kRuntimeISA, "default");
@@ -42,6 +43,11 @@
     graph_->SetEntryBlock(entry_);
   }
 
+  void TearDown() override {
+    TEST_TEARDOWN_DISABLED_FOR_RISCV64();
+    OptimizingUnitTest::TearDown();
+  }
+
  protected:
   HBasicBlock* CreateSuccessor(HBasicBlock* block) {
     HGraph* graph = block->GetGraph();
@@ -58,6 +64,7 @@
 };
 
 TEST_F(SsaLivenessAnalysisTest, TestReturnArg) {
+  TEST_DISABLED_FOR_RISCV64();
   HInstruction* arg = new (GetAllocator()) HParameterValue(
       graph_->GetDexFile(), dex::TypeIndex(0), 0, DataType::Type::kInt32);
   entry_->AddInstruction(arg);
@@ -78,6 +85,7 @@
 }
 
 TEST_F(SsaLivenessAnalysisTest, TestAput) {
+  TEST_DISABLED_FOR_RISCV64();
   HInstruction* array = new (GetAllocator()) HParameterValue(
       graph_->GetDexFile(), dex::TypeIndex(0), 0, DataType::Type::kReference);
   HInstruction* index = new (GetAllocator()) HParameterValue(
@@ -147,6 +155,7 @@
 }
 
 TEST_F(SsaLivenessAnalysisTest, TestDeoptimize) {
+  TEST_DISABLED_FOR_RISCV64();
   HInstruction* array = new (GetAllocator()) HParameterValue(
       graph_->GetDexFile(), dex::TypeIndex(0), 0, DataType::Type::kReference);
   HInstruction* index = new (GetAllocator()) HParameterValue(
diff --git a/dex2oat/dex2oat_image_test.cc b/dex2oat/dex2oat_image_test.cc
index 4518905..f90c161 100644
--- a/dex2oat/dex2oat_image_test.cc
+++ b/dex2oat/dex2oat_image_test.cc
@@ -250,6 +250,7 @@
 }
 
 TEST_F(Dex2oatImageTest, TestExtension) {
+  TEST_DISABLED_FOR_RISCV64();
   std::string error_msg;
   MemMap reservation = ReserveCoreImageAddressSpace(&error_msg);
   ASSERT_TRUE(reservation.IsValid()) << error_msg;
diff --git a/dex2oat/dex2oat_test.cc b/dex2oat/dex2oat_test.cc
index ca76254..db7e55a 100644
--- a/dex2oat/dex2oat_test.cc
+++ b/dex2oat/dex2oat_test.cc
@@ -1479,6 +1479,7 @@
 class Dex2oatDedupeCode : public Dex2oatTest {};
 
 TEST_F(Dex2oatDedupeCode, DedupeTest) {
+  TEST_DISABLED_FOR_RISCV64();
   // Use MyClassNatives. It has lots of native methods that will produce deduplicate-able code.
   std::unique_ptr<const DexFile> dex(OpenTestDexFile("MyClassNatives"));
   std::string out_dir = GetScratchDir();
diff --git a/dex2oat/driver/compiler_driver_test.cc b/dex2oat/driver/compiler_driver_test.cc
index 759426a..a82de05 100644
--- a/dex2oat/driver/compiler_driver_test.cc
+++ b/dex2oat/driver/compiler_driver_test.cc
@@ -261,6 +261,7 @@
 };
 
 TEST_F(CompilerDriverProfileTest, ProfileGuidedCompilation) {
+  TEST_DISABLED_FOR_RISCV64();
   Thread* self = Thread::Current();
   jobject class_loader;
   {
diff --git a/dex2oat/linker/image_test.cc b/dex2oat/linker/image_test.cc
index 82c87f5..fc69db4 100644
--- a/dex2oat/linker/image_test.cc
+++ b/dex2oat/linker/image_test.cc
@@ -107,6 +107,7 @@
 // only if the copied method and the origin method are located in the
 // same oat file.
 TEST_F(ImageTest, TestDefaultMethods) {
+  TEST_DISABLED_FOR_RISCV64();
   CompilationHelper helper;
   Compile(ImageHeader::kStorageModeUncompressed,
           /*max_image_block_size=*/std::numeric_limits<uint32_t>::max(),
diff --git a/dex2oat/verifier_deps_test.cc b/dex2oat/verifier_deps_test.cc
index 00593f5..bb61200 100644
--- a/dex2oat/verifier_deps_test.cc
+++ b/dex2oat/verifier_deps_test.cc
@@ -584,6 +584,7 @@
 }
 
 TEST_F(VerifierDepsTest, CompilerDriver) {
+  TEST_DISABLED_FOR_RISCV64();
   SetupCompilerDriver();
 
   // Test both multi-dex and single-dex configuration.
diff --git a/imgdiag/imgdiag_test.cc b/imgdiag/imgdiag_test.cc
index 9dd7953..3ea7093 100644
--- a/imgdiag/imgdiag_test.cc
+++ b/imgdiag/imgdiag_test.cc
@@ -115,6 +115,7 @@
 // because it's root read-only.
 TEST_F(ImgDiagTest, DISABLED_ImageDiffPidSelf) {
 #endif
+  TEST_DISABLED_FOR_RISCV64();
   // Invoke 'img_diag' against the current process.
   // This should succeed because we have a runtime and so it should
   // be able to map in the boot.art and do a diff for it.
diff --git a/libartbase/base/common_art_test.h b/libartbase/base/common_art_test.h
index d7711f2..7f018ff 100644
--- a/libartbase/base/common_art_test.h
+++ b/libartbase/base/common_art_test.h
@@ -334,4 +334,25 @@
     return; \
   }
 
+#define TEST_DISABLED_FOR_RISCV64() \
+  if (kRuntimeISA == InstructionSet::kRiscv64) { \
+    printf("WARNING: TEST DISABLED FOR RISCV64\n"); \
+    return; \
+  }
+
+// Don't print messages on setup to avoid getting multiple "test disabled" messages for one test.
+// Setup phase may need to be disabled as some test rely on having boot image / compiler / other
+// things that are not implemented for RISC-V.
+#define TEST_SETUP_DISABLED_FOR_RISCV64() \
+  if (kRuntimeISA == InstructionSet::kRiscv64) { \
+    return; \
+  }
+
+// Don't print messages on teardown to avoid getting multiple "test disabled" messages for one test.
+// Teardown phase may need to be disabled to match the disabled setup phase for some tests.
+#define TEST_TEARDOWN_DISABLED_FOR_RISCV64() \
+  if (kRuntimeISA == InstructionSet::kRiscv64) { \
+    return; \
+  }
+
 #endif  // ART_LIBARTBASE_BASE_COMMON_ART_TEST_H_
diff --git a/libartbase/base/file_utils.cc b/libartbase/base/file_utils.cc
index 8228cd6..899cea7 100644
--- a/libartbase/base/file_utils.cc
+++ b/libartbase/base/file_utils.cc
@@ -360,6 +360,9 @@
   // `<primary-boot-image-stem>-<first-library-name>.art`.
   std::string library_name = GetFirstMainlineFrameworkLibraryName(error_msg);
   if (library_name.empty()) {
+    if (kRuntimeISA == InstructionSet::kRiscv64) {
+      return true;
+    }
     return false;
   }
 
diff --git a/libartpalette/apex/palette_test.cc b/libartpalette/apex/palette_test.cc
index 63072c4..c52b046 100644
--- a/libartpalette/apex/palette_test.cc
+++ b/libartpalette/apex/palette_test.cc
@@ -54,10 +54,15 @@
 
 }  // namespace
 
+namespace art {
+
 class PaletteClientTest : public testing::Test {};
 
 TEST_F(PaletteClientTest, SchedPriority) {
-  int32_t tid = GetTid();
+  // On RISC-V tests run in Android-like chroot on a Linux VM => some syscalls work differently.
+  TEST_DISABLED_FOR_RISCV64();
+
+  int32_t tid = ::GetTid();
   int32_t saved_priority;
   EXPECT_EQ(PALETTE_STATUS_OK, PaletteSchedGetPriority(tid, &saved_priority));
 
@@ -81,6 +86,9 @@
 #ifndef ART_TARGET_ANDROID
   GTEST_SKIP() << "ashmem is only supported on Android";
 #else
+  // On RISC-V tests run in Android-like chroot on a Linux VM => some syscalls work differently.
+  TEST_DISABLED_FOR_RISCV64();
+
   int fd;
   EXPECT_EQ(PALETTE_STATUS_OK, PaletteAshmemCreateRegion("ashmem-test", 4096, &fd));
   EXPECT_EQ(PALETTE_STATUS_OK, PaletteAshmemSetProtRegion(fd, PROT_READ | PROT_EXEC));
@@ -166,3 +174,5 @@
   }
 #endif
 }
+
+}  // namespace art
diff --git a/oatdump/oatdump_app_test.cc b/oatdump/oatdump_app_test.cc
index 9c37707..c52c080 100644
--- a/oatdump/oatdump_app_test.cc
+++ b/oatdump/oatdump_app_test.cc
@@ -19,22 +19,26 @@
 namespace art {
 
 TEST_F(OatDumpTest, TestAppWithBootImage) {
+  TEST_DISABLED_FOR_RISCV64();
   ASSERT_TRUE(GenerateAppOdexFile(Flavor::kDynamic, {"--runtime-arg", "-Xmx64M"}));
   ASSERT_TRUE(Exec(Flavor::kDynamic, kModeOatWithBootImage, {}, kListAndCode));
 }
 TEST_F(OatDumpTest, TestAppWithBootImageStatic) {
+  TEST_DISABLED_FOR_RISCV64();
   TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS();
   ASSERT_TRUE(GenerateAppOdexFile(Flavor::kStatic, {"--runtime-arg", "-Xmx64M"}));
   ASSERT_TRUE(Exec(Flavor::kStatic, kModeOatWithBootImage, {}, kListAndCode));
 }
 
 TEST_F(OatDumpTest, TestAppImageWithBootImage) {
+  TEST_DISABLED_FOR_RISCV64();
   TEST_DISABLED_WITHOUT_BAKER_READ_BARRIERS();  // GC bug, b/126305867
   const std::string app_image_arg = "--app-image-file=" + GetAppImageName();
   ASSERT_TRUE(GenerateAppOdexFile(Flavor::kDynamic, {"--runtime-arg", "-Xmx64M", app_image_arg}));
   ASSERT_TRUE(Exec(Flavor::kDynamic, kModeAppImage, {}, kListAndCode));
 }
 TEST_F(OatDumpTest, TestAppImageWithBootImageStatic) {
+  TEST_DISABLED_FOR_RISCV64();
   TEST_DISABLED_WITHOUT_BAKER_READ_BARRIERS();  // GC bug, b/126305867
   TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS();
   const std::string app_image_arg = "--app-image-file=" + GetAppImageName();
@@ -43,6 +47,7 @@
 }
 
 TEST_F(OatDumpTest, TestAppImageInvalidPath) {
+  TEST_DISABLED_FOR_RISCV64();
   TEST_DISABLED_WITHOUT_BAKER_READ_BARRIERS();  // GC bug, b/126305867
   TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS();
   const std::string app_image_arg = "--app-image-file=" + GetAppImageName();
diff --git a/oatdump/oatdump_image_test.cc b/oatdump/oatdump_image_test.cc
index 7308f82..88dce25 100644
--- a/oatdump/oatdump_image_test.cc
+++ b/oatdump/oatdump_image_test.cc
@@ -24,11 +24,13 @@
     TEST_DISABLED_FOR_ARM64(); \
 
 TEST_F(OatDumpTest, TestImage) {
+  TEST_DISABLED_FOR_RISCV64();
   TEST_DISABLED_FOR_ARM_AND_ARM64();
   std::string error_msg;
   ASSERT_TRUE(Exec(Flavor::kDynamic, kModeArt, {}, kListAndCode));
 }
 TEST_F(OatDumpTest, TestImageStatic) {
+  TEST_DISABLED_FOR_RISCV64();
   TEST_DISABLED_FOR_ARM_AND_ARM64();
   TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS();
   std::string error_msg;
@@ -36,11 +38,13 @@
 }
 
 TEST_F(OatDumpTest, TestOatImage) {
+  TEST_DISABLED_FOR_RISCV64();
   TEST_DISABLED_FOR_ARM_AND_ARM64();
   std::string error_msg;
   ASSERT_TRUE(Exec(Flavor::kDynamic, kModeCoreOat, {}, kListAndCode));
 }
 TEST_F(OatDumpTest, TestOatImageStatic) {
+  TEST_DISABLED_FOR_RISCV64();
   TEST_DISABLED_FOR_ARM_AND_ARM64();
   TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS();
   std::string error_msg;
diff --git a/oatdump/oatdump_test.cc b/oatdump/oatdump_test.cc
index 49bee48..d8ba87c 100644
--- a/oatdump/oatdump_test.cc
+++ b/oatdump/oatdump_test.cc
@@ -26,11 +26,13 @@
     TEST_DISABLED_FOR_ARM64(); \
 
 TEST_F(OatDumpTest, TestNoDumpVmap) {
+  TEST_DISABLED_FOR_RISCV64();
   TEST_DISABLED_FOR_ARM_AND_ARM64();
   std::string error_msg;
   ASSERT_TRUE(Exec(Flavor::kDynamic, kModeArt, {"--no-dump:vmap"}, kListAndCode));
 }
 TEST_F(OatDumpTest, TestNoDumpVmapStatic) {
+  TEST_DISABLED_FOR_RISCV64();
   TEST_DISABLED_FOR_ARM_AND_ARM64();
   TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS();
   std::string error_msg;
@@ -38,11 +40,13 @@
 }
 
 TEST_F(OatDumpTest, TestNoDisassemble) {
+  TEST_DISABLED_FOR_RISCV64();
   TEST_DISABLED_FOR_ARM_AND_ARM64();
   std::string error_msg;
   ASSERT_TRUE(Exec(Flavor::kDynamic, kModeArt, {"--no-disassemble"}, kListAndCode));
 }
 TEST_F(OatDumpTest, TestNoDisassembleStatic) {
+  TEST_DISABLED_FOR_RISCV64();
   TEST_DISABLED_FOR_ARM_AND_ARM64();
   TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS();
   std::string error_msg;
@@ -50,11 +54,13 @@
 }
 
 TEST_F(OatDumpTest, TestListClasses) {
+  TEST_DISABLED_FOR_RISCV64();
   TEST_DISABLED_FOR_ARM_AND_ARM64();
   std::string error_msg;
   ASSERT_TRUE(Exec(Flavor::kDynamic, kModeArt, {"--list-classes"}, kListOnly));
 }
 TEST_F(OatDumpTest, TestListClassesStatic) {
+  TEST_DISABLED_FOR_RISCV64();
   TEST_DISABLED_FOR_ARM_AND_ARM64();
   TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS();
   std::string error_msg;
@@ -62,11 +68,13 @@
 }
 
 TEST_F(OatDumpTest, TestListMethods) {
+  TEST_DISABLED_FOR_RISCV64();
   TEST_DISABLED_FOR_ARM_AND_ARM64();
   std::string error_msg;
   ASSERT_TRUE(Exec(Flavor::kDynamic, kModeArt, {"--list-methods"}, kListOnly));
 }
 TEST_F(OatDumpTest, TestListMethodsStatic) {
+  TEST_DISABLED_FOR_RISCV64();
   TEST_DISABLED_FOR_ARM_AND_ARM64();
   TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS();
   std::string error_msg;
@@ -74,11 +82,13 @@
 }
 
 TEST_F(OatDumpTest, TestSymbolize) {
+  TEST_DISABLED_FOR_RISCV64();
   TEST_DISABLED_FOR_TARGET();  // Can not write files inside the apex directory.
   std::string error_msg;
   ASSERT_TRUE(Exec(Flavor::kDynamic, kModeSymbolize, {}, kListOnly));
 }
 TEST_F(OatDumpTest, TestSymbolizeStatic) {
+  TEST_DISABLED_FOR_RISCV64();
   TEST_DISABLED_FOR_ARM_AND_ARM64();
   TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS();
   std::string error_msg;
@@ -86,6 +96,7 @@
 }
 
 TEST_F(OatDumpTest, TestExportDex) {
+  TEST_DISABLED_FOR_RISCV64();
   std::string error_msg;
   ASSERT_TRUE(GenerateAppOdexFile(Flavor::kDynamic, {"--runtime-arg", "-Xmx64M"}));
   ASSERT_TRUE(Exec(Flavor::kDynamic, kModeOat, {"--export-dex-to=" + tmp_dir_}, kListOnly));
@@ -102,6 +113,7 @@
   ASSERT_TRUE(res.StandardSuccess());
 }
 TEST_F(OatDumpTest, TestExportDexStatic) {
+  TEST_DISABLED_FOR_RISCV64();
   TEST_DISABLED_FOR_ARM_AND_ARM64();
   TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS();
   std::string error_msg;
diff --git a/runtime/gc/space/image_space_test.cc b/runtime/gc/space/image_space_test.cc
index d6bb86b..5f4039c 100644
--- a/runtime/gc/space/image_space_test.cc
+++ b/runtime/gc/space/image_space_test.cc
@@ -436,6 +436,7 @@
 TEST_F(ImageSpaceLoadingSingleComponentWithProfilesTest, Test) {
   // Compiling the primary boot image into a single image is not allowed on host.
   TEST_DISABLED_FOR_HOST();
+  TEST_DISABLED_FOR_RISCV64();
 
   CheckImageSpaceAndOatFile(/*space_count=*/1);
 }
@@ -490,6 +491,7 @@
 TEST_F(ImageSpaceLoadingMultipleComponentsWithProfilesTest, Test) {
   // Compiling the primary boot image into a single image is not allowed on host.
   TEST_DISABLED_FOR_HOST();
+  TEST_DISABLED_FOR_RISCV64();
 
   CheckImageSpaceAndOatFile(/*space_count=*/1);
 }
diff --git a/runtime/parsed_options_test.cc b/runtime/parsed_options_test.cc
index 7cc6432..3d45da5 100644
--- a/runtime/parsed_options_test.cc
+++ b/runtime/parsed_options_test.cc
@@ -165,9 +165,10 @@
     EXPECT_EQ(kRuntimeISA, isa);
   }
 
-  const char* isa_strings[] = { "arm", "arm64", "x86", "x86_64" };
+  const char* isa_strings[] = { "arm", "arm64", "riscv64", "x86", "x86_64" };
   InstructionSet ISAs[] = { InstructionSet::kArm,
                             InstructionSet::kArm64,
+                            InstructionSet::kRiscv64,
                             InstructionSet::kX86,
                             InstructionSet::kX86_64 };
   static_assert(arraysize(isa_strings) == arraysize(ISAs), "Need same amount.");
diff --git a/tools/run-gtests.sh b/tools/run-gtests.sh
index da61c7e..99ac8df 100755
--- a/tools/run-gtests.sh
+++ b/tools/run-gtests.sh
@@ -61,7 +61,7 @@
 
 run_in_chroot() {
   if [ -n "$ART_TEST_ON_VM" ]; then
-    $ART_SSH_CMD $ART_CHROOT_CMD $@
+    $ART_SSH_CMD $ART_CHROOT_CMD env ANDROID_ROOT=/system $@
   else
     "$adb" shell chroot "$ART_TEST_CHROOT" $@
   fi