Fix assertions for Profman BootImageProfile tests
As part of the work done in aosp/2132472, we discovered that the
two tests in Profman for boot image profiles have different
behaviours (the first test creates a boot profile for a boot image,
while the second does not). We also realised that there are no
assertions around the call to ProfileCompilationInfo#Load, which is
expected to return true is the profile is loaded correctly and false
otherwise. This CL solves both issues, and makes the two test cases
more similar between themselves (maintaining the crucial difference
that the first tests has a single profile while the second has two
different profiles that need to be merged).
Test: atest art_profman_tests
Change-Id: I00620e97318540532971d8d0dd8d140576225a03
diff --git a/profman/profile_assistant_test.cc b/profman/profile_assistant_test.cc
index 7121697..d8f0b82 100644
--- a/profman/profile_assistant_test.cc
+++ b/profman/profile_assistant_test.cc
@@ -971,7 +971,7 @@
/*for_boot_image=*/ true));
ProfileCompilationInfo bootProfile(/*for_boot_image=*/ true);
- bootProfile.Load(profile.GetFilename(), /*clear_if_invalid=*/ true);
+ EXPECT_TRUE(bootProfile.Load(profile.GetFilename(), /*clear_if_invalid=*/ false));
// Generate the boot profile.
ScratchFile out_profile;
@@ -1065,10 +1065,10 @@
core_dex,
/*for_boot_image=*/ true));
- ProfileCompilationInfo boot_profile1;
- ProfileCompilationInfo boot_profile2;
- boot_profile1.Load(profile1.GetFilename(), /*for_boot_image=*/ true);
- boot_profile2.Load(profile2.GetFilename(), /*for_boot_image=*/ true);
+ ProfileCompilationInfo boot_profile1(/*for_boot_image=*/ true);
+ ProfileCompilationInfo boot_profile2(/*for_boot_image=*/ true);
+ EXPECT_TRUE(boot_profile1.Load(profile1.GetFilename(), /*clear_if_invalid=*/ false));
+ EXPECT_TRUE(boot_profile2.Load(profile2.GetFilename(), /*clear_if_invalid=*/ false));
// Generate the boot profile.
ScratchFile out_profile;