mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-11 13:30:47 -04:00
test: more filesystem writer error test cases
This commit is contained in:
parent
927ab3ab92
commit
b924be0610
@ -31,6 +31,8 @@
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include <fmt/chrono.h>
|
||||
#include <fmt/format.h>
|
||||
|
||||
@ -1313,10 +1315,19 @@ class mkdwarfs_recompress_test
|
||||
|
||||
TEST_P(mkdwarfs_recompress_test, recompress) {
|
||||
std::string const compression{GetParam()};
|
||||
std::string compression_type = compression;
|
||||
std::string const image_file = "test.dwarfs";
|
||||
std::string image;
|
||||
fsinfo_options const history_opts{.features = {fsinfo_feature::history}};
|
||||
|
||||
if (auto pos = compression_type.find(':'); pos != std::string::npos) {
|
||||
compression_type.erase(pos);
|
||||
}
|
||||
boost::algorithm::to_upper(compression_type);
|
||||
if (compression_type == "NULL") {
|
||||
compression_type = "NONE";
|
||||
}
|
||||
|
||||
{
|
||||
mkdwarfs_tester t;
|
||||
t.os->add_local_files(audio_data_dir);
|
||||
@ -1374,6 +1385,39 @@ TEST_P(mkdwarfs_recompress_test, recompress) {
|
||||
EXPECT_TRUE(fs.find("/random"));
|
||||
}
|
||||
|
||||
#ifdef DWARFS_HAVE_FLAC
|
||||
{
|
||||
auto t = tester(image);
|
||||
EXPECT_EQ(1, t.run({"-i", image_file, "-o", "-", "--recompress=block",
|
||||
"--recompress-categories=!pcmaudio/waveform", "-C",
|
||||
"pcmaudio/metadata::flac:level=4"}))
|
||||
<< t.err();
|
||||
EXPECT_THAT(t.err(),
|
||||
::testing::HasSubstr(fmt::format(
|
||||
"cannot compress {} compressed block with compressor 'flac "
|
||||
"[level=4]' because the following metadata requirements "
|
||||
"are not met: missing requirement 'bits_per_sample'",
|
||||
compression_type)));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DWARFS_HAVE_RICEPP
|
||||
{
|
||||
auto t = tester(image);
|
||||
EXPECT_EQ(1, t.run({"-i", image_file, "-o", "-", "--recompress=block",
|
||||
"--recompress-categories=!pcmaudio/waveform", "-C",
|
||||
"pcmaudio/metadata::ricepp"}))
|
||||
<< t.err();
|
||||
EXPECT_THAT(
|
||||
t.err(),
|
||||
::testing::HasSubstr(fmt::format(
|
||||
"cannot compress {} compressed block with compressor 'ricepp "
|
||||
"[block_size=128]' because the following metadata requirements are "
|
||||
"not met: missing requirement 'bytes_per_sample'",
|
||||
compression_type)));
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
auto t = tester(image);
|
||||
EXPECT_EQ(1, t.run({"-i", image_file, "-o", "-", "--recompress",
|
||||
|
Loading…
x
Reference in New Issue
Block a user