Move loopdevice module to dm_rust lib
This is a generic module, not specific to apkdmverity. Will be reused
for unit-testing other dm- devices. Also, setup the test infra for
dm_rust module...
Bug: 250880499
Test: atest libdm_rust.test
Test: atest apkdmverity.test
Change-Id: I32971938908ea8c0213583885403910baac8be10
diff --git a/libs/devicemapper/AndroidTest.xml b/libs/devicemapper/AndroidTest.xml
new file mode 100644
index 0000000..9890bb6
--- /dev/null
+++ b/libs/devicemapper/AndroidTest.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2022 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<configuration description="Config for device mapper tests">
+ <!--
+ Creating and configuring the loop devices and the device-mapper devices require root privilege.
+ -->
+ <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/>
+
+ <!--
+ We need to disable selinux because kernel (which is implementing the loop device) doesn't have
+ the privilege to read files on /data. Otherwise, we hit the following errors:
+
+ avc: denied { read } for comm="loop32"
+ path="/data/local/tmp/.tmp.ptPChH/**" dev="dm-8" ino=2939
+ scontext=u:r:kernel:s0 tcontext=u:object_r:shell_data_file:s0
+ tclass=file
+ -->
+ <target_preparer class="com.android.tradefed.targetprep.DisableSELinuxTargetPreparer"/>
+
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="push-file" key="libdm_rust.test" value="/data/local/tmp/libdm_rust.test" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.rust.RustBinaryTest" >
+ <option name="test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="libdm_rust.test" />
+ </test>
+</configuration>