1<?xml version="1.0" encoding="utf-8"?>
2<!-- Copyright (C) 2020 The Android Open Source Project
3     Licensed under the Apache License, Version 2.0 (the "License");
4     you may not use this file except in compliance with the License.
5     You may obtain a copy of the License at
6          http://www.apache.org/licenses/LICENSE-2.0
7     Unless required by applicable law or agreed to in writing, software
8     distributed under the License is distributed on an "AS IS" BASIS,
9     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10     See the License for the specific language governing permissions and
11     limitations under the License.
12-->
13<!DOCTYPE configuration [
14    <!ENTITY ltp_root "/data/local/tmp/ltp">
15    <!ENTITY ltp_dir "/data/local/tmp/ltp/DATA/nativetest{}/ltp">
16    <!ENTITY ltp_bin_dir "&ltp_dir;/testcases/bin">
17    <!ENTITY env_setup_cmd "export TMP=&ltp_dir;/tmp LTPTMP=&ltp_dir;/tmp/ltptemp PATH=/system/bin:&ltp_dir;/testcases/bin LTP_DEV_FS_TYPE=ext4 TMPBASE=&ltp_dir;/tmp/tmpbase TMPDIR=&ltp_dir;/tmp/tmpdir LTPROOT=&ltp_dir; ">
18]>
19<configuration description="Runs vts_ltp_test.">
20    <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/>
21    <target_preparer class="com.android.tradefed.targetprep.StopServicesSetup"/>
22
23    <object type="module_controller" class="com.android.tradefed.testtype.suite.module.KernelTestModuleController" >
24{}
25    </object>
26
27    <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
28        <option name="cleanup" value="true" />
29        <!-- LTP tests must be pushed to `/data/local/tmp/ltp` which has the right security context setting.
30          Any other directory might not work. -->
31        <option name="push" value="vts_kernel_tests->&ltp_root;" />
32    </target_preparer>
33
34    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
35        <option name="run-command" value='find &ltp_dir; -type f | xargs grep -l -e "bin/sh" -e "bin/bash" | xargs sed -i -e "s?/bin/echo?echo?" -i -e "s?#!/bin/sh?#!/system/bin/sh?" -i -e "s?#!/bin/bash?#!/system/bin/sh?" -i -e "s?bs=1M?#bs=1m?"' />
36        <option name="run-command" value='mkdir -p &ltp_dir;/tmp; chmod 777 &ltp_dir;/tmp' />
37        <option name="run-command" value='mkdir -p &ltp_dir;/tmp/tmpbase; chmod 777 &ltp_dir;/tmp/tmpbase' />
38        <option name="run-command" value='mkdir -p &ltp_dir;/tmp/ltptemp; chmod 777 &ltp_dir;/tmp/ltptemp' />
39        <option name="run-command" value='mkdir -p &ltp_dir;/tmp/tmpdir; chmod 777 &ltp_dir;/tmp/tmpdir' />
40         <!-- Apply the right security context for kernel tests to work. -->
41        <option name="run-command" value='restorecon -F -R &ltp_root;' />
42        <option name="teardown-command" value="rm -rf &ltp_dir;/tmp" />
43    </target_preparer>
44
45    <test class="com.android.tradefed.testtype.binary.KernelTargetTest" >
46        <option name="ignore-binary-check" value="true" />
47        <!-- Set binary timeout to be 18 min which is greater than the default 5 min timeout. Otherwise TF will retry to the command and attempt to do device recovery. -->
48        <option name="per-binary-timeout" value="1080000" />
49{}
50    </test>
51</configuration>
52