[PATCH] D144524: [llvm-profdata] Add more unit tests to check --output-size-limit feature when compression is enabled
William Junda Huang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 15 17:34:28 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd8690bc1eae0: [llvm-profdata] Add more unit tests to check --output-size-limit feature when… (authored by huangjd).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144524/new/
https://reviews.llvm.org/D144524
Files:
llvm/unittests/tools/llvm-profdata/OutputSizeLimitTest.cpp
Index: llvm/unittests/tools/llvm-profdata/OutputSizeLimitTest.cpp
===================================================================
--- llvm/unittests/tools/llvm-profdata/OutputSizeLimitTest.cpp
+++ llvm/unittests/tools/llvm-profdata/OutputSizeLimitTest.cpp
@@ -77,7 +77,8 @@
/// Note that even though by default samples with fewest total count are dropped
/// first, this is not a requirement. Samples can be dropped by any order.
static ExpectedErrorOr<void *> RunTest(StringRef Input, size_t SizeLimit,
- SampleProfileFormat Format) {
+ SampleProfileFormat Format,
+ bool Compress = false) {
// Read Input profile.
auto FS = vfs::getRealFileSystem();
LLVMContext Context;
@@ -93,6 +94,8 @@
{
DEF_VAR_RETURN_IF_ERROR(Writer,
SampleProfileWriter::create(Temp.path(), Format));
+ if (Compress)
+ Writer->setToCompressAllSections();
std::error_code EC = Writer->writeWithSizeLimit(OldProfiles, SizeLimit);
// too_large means no sample could be written because SizeLimit is too
// small. Otherwise any other error code indicates unexpected failure.
@@ -180,3 +183,11 @@
RunTest(Input1, OutputSizeLimit, llvm::sampleprof::SPF_Text),
Succeeded());
}
+
+TEST(TestOutputSizeLimit, TestOutputSizeLimitExtBinaryCompressed) {
+ for (size_t OutputSizeLimit :
+ {507, 506, 505, 494, 493, 492, 483, 482, 481, 480})
+ ASSERT_THAT_EXPECTED(RunTest(Input1, OutputSizeLimit,
+ llvm::sampleprof::SPF_Ext_Binary, true),
+ Succeeded());
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144524.505668.patch
Type: text/x-patch
Size: 1694 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230316/b2f58963/attachment.bin>
More information about the llvm-commits
mailing list