am c2e176d4: am 0815f2a1: Merge "Fix file path separator issue when running cts on windows"
* commit 'c2e176d4f9777fa0c81b7366b80d22cc0e056f02':
Fix file path separator issue when running cts on windows
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/GeeTest.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/GeeTest.java
index 5cfafc6..035b4a2 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/GeeTest.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/GeeTest.java
@@ -40,6 +40,8 @@
public class GeeTest implements IBuildReceiver, IDeviceTest, IRemoteTest {
private static final String NATIVE_TESTS_DIRECTORY = "/data/local/tmp/cts-native-tests";
+ private static final String NATIVE_TESTS_DIRECTORY_TMP = "/data/local/tmp";
+ private static final String ANDROID_PATH_SEPARATOR = "/";
private int mMaxTestTimeMs = 1 * 60 * 1000;
@@ -75,8 +77,8 @@
return false;
}
- File devicePath = new File(NATIVE_TESTS_DIRECTORY, mExeName);
- if (!mDevice.pushFile(nativeExe, devicePath.toString())) {
+ String devicePath = NATIVE_TESTS_DIRECTORY + ANDROID_PATH_SEPARATOR + mExeName;
+ if (!mDevice.pushFile(nativeExe, devicePath)) {
CLog.e("Failed to push native test to device");
return false;
}
@@ -87,13 +89,11 @@
if (mDevice.doesFileExist(remoteFilePath)) {
return true;
}
- File remoteFile = new File(remoteFilePath);
- String parentPath = remoteFile.getParent();
- if (parentPath != null) {
- if (!createRemoteDir(parentPath)) {
- return false;
- }
+ if (!(mDevice.doesFileExist(NATIVE_TESTS_DIRECTORY_TMP))) {
+ CLog.e("Could not find the /data/local/tmp directory");
+ return false;
}
+
mDevice.executeShellCommand(String.format("mkdir %s", remoteFilePath));
return mDevice.doesFileExist(remoteFilePath);
}
@@ -102,7 +102,7 @@
GeeTestResultParser resultParser = new GeeTestResultParser(mPackageName, listener);
resultParser.setFakePackagePrefix(mPackageName + ".");
- String fullPath = NATIVE_TESTS_DIRECTORY + File.separator + mExeName;
+ String fullPath = NATIVE_TESTS_DIRECTORY + ANDROID_PATH_SEPARATOR + mExeName;
String flags = "";
CLog.v("Running gtest %s %s on %s", fullPath, flags, mDevice.getSerialNumber());
// force file to be executable