Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base-old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Farzin Kazemzadeh
platform_frameworks_base-old
Commits
6ca34576
Commit
6ca34576
authored
1 year ago
by
Victor Hsieh
Committed by
Android (Google) Code Review
1 year ago
Browse files
Options
Downloads
Plain Diff
Merge "Construct file path based on current user ID in test" into main
parents
32bacee3
71c44795
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/FsVerityTest/src/com/android/fsverity/FsVerityHostTest.java
+14
-9
14 additions, 9 deletions
...VerityTest/src/com/android/fsverity/FsVerityHostTest.java
with
14 additions
and
9 deletions
tests/FsVerityTest/src/com/android/fsverity/FsVerityHostTest.java
+
14
−
9
View file @
6ca34576
...
...
@@ -25,6 +25,7 @@ import android.platform.test.flag.junit.host.HostFlagsValueProvider;
import
android.security.Flags
;
import
com.android.blockdevicewriter.BlockDeviceWriter
;
import
com.android.tradefed.device.DeviceNotAvailableException
;
import
com.android.tradefed.device.ITestDevice
;
import
com.android.tradefed.testtype.DeviceJUnit4ClassRunner
;
import
com.android.tradefed.testtype.junit4.BaseHostJUnit4Test
;
...
...
@@ -52,7 +53,6 @@ public class FsVerityHostTest extends BaseHostJUnit4Test {
private
static
final
String
TARGET_PACKAGE
=
"com.android.fsverity"
;
private
static
final
String
BASENAME
=
"test.file"
;
private
static
final
String
TARGET_PATH
=
"/data/data/"
+
TARGET_PACKAGE
+
"/files/"
+
BASENAME
;
@Rule
public
final
CheckFlagsRule
mCheckFlagsRule
=
...
...
@@ -63,11 +63,11 @@ public class FsVerityHostTest extends BaseHostJUnit4Test {
prepareTest
(
10000
);
ITestDevice
device
=
getDevice
();
BlockDeviceWriter
.
damageFileAgainstBlockDevice
(
device
,
TARGET_PATH
,
0
);
BlockDeviceWriter
.
damageFileAgainstBlockDevice
(
device
,
TARGET_PATH
,
8192
);
BlockDeviceWriter
.
damageFileAgainstBlockDevice
(
device
,
getTargetFilePath
()
,
0
);
BlockDeviceWriter
.
damageFileAgainstBlockDevice
(
device
,
getTargetFilePath
()
,
8192
);
BlockDeviceWriter
.
dropCaches
(
device
);
verifyRead
(
TARGET_PATH
,
"0,2"
);
verifyRead
(
getTargetFilePath
()
,
"0,2"
);
}
@Test
...
...
@@ -75,12 +75,17 @@ public class FsVerityHostTest extends BaseHostJUnit4Test {
prepareTest
(
128
*
4096
+
1
);
ITestDevice
device
=
getDevice
();
BlockDeviceWriter
.
damageFileAgainstBlockDevice
(
device
,
TARGET_PATH
,
4096
);
BlockDeviceWriter
.
damageFileAgainstBlockDevice
(
device
,
TARGET_PATH
,
100
*
4096
);
BlockDeviceWriter
.
damageFileAgainstBlockDevice
(
device
,
TARGET_PATH
,
128
*
4096
+
1
);
BlockDeviceWriter
.
damageFileAgainstBlockDevice
(
device
,
getTargetFilePath
()
,
4096
);
BlockDeviceWriter
.
damageFileAgainstBlockDevice
(
device
,
getTargetFilePath
()
,
100
*
4096
);
BlockDeviceWriter
.
damageFileAgainstBlockDevice
(
device
,
getTargetFilePath
()
,
128
*
4096
+
1
);
BlockDeviceWriter
.
dropCaches
(
device
);
verifyRead
(
TARGET_PATH
,
"1,100,128"
);
verifyRead
(
getTargetFilePath
(),
"1,100,128"
);
}
private
String
getTargetFilePath
()
throws
DeviceNotAvailableException
{
return
"/data/user/"
+
getDevice
().
getCurrentUser
()
+
"/"
+
TARGET_PACKAGE
+
"/files/"
+
BASENAME
;
}
private
void
prepareTest
(
int
fileSize
)
throws
Exception
{
...
...
@@ -97,7 +102,7 @@ public class FsVerityHostTest extends BaseHostJUnit4Test {
options
.
setTestClassName
(
TARGET_PACKAGE
+
".Helper"
);
options
.
setTestMethodName
(
"verifyFileRead"
);
options
.
addInstrumentationArg
(
"brokenBlockIndicesCsv"
,
indicesCsv
);
options
.
addInstrumentationArg
(
"filePath"
,
TARGET_PATH
);
options
.
addInstrumentationArg
(
"filePath"
,
getTargetFilePath
()
);
assertThat
(
runDeviceTests
(
options
)).
isTrue
();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment