Fix CopyEfsTest for symlinks
Use the -L flag to preserve symlinks. Fixed various flags to ensure we handle symlinks right, and adjusted the awk string to handle difference in how dates are represented. Test: atest CopyEfsTest Flag: TEST_ONLY Bug: 352567354 Change-Id: I686c16fc1d771bf00bdc7465beb29a91eaef9e46
This commit is contained in:
parent
e32a7f759b
commit
069a8098b3
1 changed files with 11 additions and 4 deletions
|
@ -69,15 +69,22 @@ public class CopyEfsTest extends BaseHostJUnit4Test {
|
|||
r = getDevice().executeShellV2Command("umount /data/local/tmp/efs_test/mnt");
|
||||
assertEquals(r.getExitCode().intValue(), 0);
|
||||
|
||||
r = getDevice().executeShellV2Command(String.format("dump.f2fs -rfPo /data/local/tmp/efs_test/dump /data/local/tmp/efs_test/%s.img", name));
|
||||
r = getDevice().executeShellV2Command(String.format("dump.f2fs -rfPLo /data/local/tmp/efs_test/dump /data/local/tmp/efs_test/%s.img", name));
|
||||
assertEquals(r.getExitCode().intValue(), 0);
|
||||
r = getDevice().executeShellV2Command(String.format("mount -r /data/local/tmp/efs_test/%s.img /data/local/tmp/efs_test/mnt", name));
|
||||
assertEquals(r.getExitCode().intValue(), 0);
|
||||
|
||||
assertEquals("", getDevice().executeShellCommand("diff -rq /data/local/tmp/efs_test/mnt /data/local/tmp/efs_test/dump"));
|
||||
// Remove timestamps at positions 6 and 7, because ls on device does not support --time-style
|
||||
r = getDevice().executeShellV2Command("diff -rq --no-dereference /data/local/tmp/efs_test/mnt /data/local/tmp/efs_test/dump");
|
||||
assertEquals(r.getExitCode().intValue(), 0);
|
||||
assertEquals(r.getStdout(), "");
|
||||
|
||||
// Remove timestamps because ls on device does not support --time-style. This is AWKward.
|
||||
// Format is [permissions] [links] [uid] [gid] [size] time [name/symlink]
|
||||
// time may have different numbers of blocks
|
||||
// symlinks will be of the form a -> b
|
||||
// So we can check for -> in the second to last spot to determine what position the timestamp ends at
|
||||
// Remove totals because on disk block usage may change depending on filesystem
|
||||
String ls_cmd = "cd /data/local/tmp/efs_test/%s;ls -AlLnR . | awk {'$6=\"\";$7=\"\";if ($1 != \"total\"){print $0}'}";
|
||||
String ls_cmd = "cd /data/local/tmp/efs_test/%s;ls -AlnR . | awk {'if (NF>3 && $(NF-1) == \"->\") end=3; else end=1; for(i=6;i<=NF-end && i>0;i++)$i=\"\";if ($1 != \"total\"){print $0}'}";
|
||||
String mnt_ls = getDevice().executeShellCommand(String.format(ls_cmd, "mnt"));
|
||||
assertEquals(getDevice().executeShellCommand("echo $?"), "0\n");
|
||||
String dump_ls = getDevice().executeShellCommand(String.format(ls_cmd, "dump"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue