mirror of
https://github.com/mhx/dwarfs.git
synced 2025-08-04 10:16:34 -04:00
chore(dwarfsextract): use iolayer abstractions for mapping image
This commit is contained in:
parent
aaf8c91366
commit
a1ba52d146
@ -35,6 +35,7 @@
|
|||||||
#include "dwarfs/logger.h"
|
#include "dwarfs/logger.h"
|
||||||
#include "dwarfs/mmap.h"
|
#include "dwarfs/mmap.h"
|
||||||
#include "dwarfs/options.h"
|
#include "dwarfs/options.h"
|
||||||
|
#include "dwarfs/os_access.h"
|
||||||
#include "dwarfs/performance_monitor.h"
|
#include "dwarfs/performance_monitor.h"
|
||||||
#include "dwarfs/tool.h"
|
#include "dwarfs/tool.h"
|
||||||
#include "dwarfs/util.h"
|
#include "dwarfs/util.h"
|
||||||
@ -137,7 +138,7 @@ int dwarfsextract_main(int argc, sys_char** argv, iolayer const& iol) {
|
|||||||
std::shared_ptr<performance_monitor> perfmon =
|
std::shared_ptr<performance_monitor> perfmon =
|
||||||
performance_monitor::create(perfmon_enabled);
|
performance_monitor::create(perfmon_enabled);
|
||||||
|
|
||||||
filesystem_v2 fs(lgr, std::make_shared<mmap>(filesystem), fsopts, perfmon);
|
filesystem_v2 fs(lgr, iol.os->map_file(filesystem), fsopts, perfmon);
|
||||||
filesystem_extractor fsx(lgr);
|
filesystem_extractor fsx(lgr);
|
||||||
|
|
||||||
if (format.empty()) {
|
if (format.empty()) {
|
||||||
|
@ -54,7 +54,6 @@ namespace {
|
|||||||
|
|
||||||
auto test_dir = fs::path(TEST_DATA_DIR).make_preferred();
|
auto test_dir = fs::path(TEST_DATA_DIR).make_preferred();
|
||||||
auto audio_data_dir = test_dir / "pcmaudio";
|
auto audio_data_dir = test_dir / "pcmaudio";
|
||||||
auto test_data_image = test_dir / "data.dwarfs";
|
|
||||||
|
|
||||||
enum class input_mode {
|
enum class input_mode {
|
||||||
from_file,
|
from_file,
|
||||||
@ -429,14 +428,13 @@ TEST_F(dwarfsextract_main_test, cmdline_help_arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DWARFS_PERFMON_ENABLED
|
#ifdef DWARFS_PERFMON_ENABLED
|
||||||
TEST_F(dwarfsextract_main_test, perfmon) {
|
TEST(dwarfsextract_test, perfmon) {
|
||||||
// TODO: passing in test_data_image this way only only works because
|
auto t = dwarfsextract_tester::create_with_image();
|
||||||
// dwarfsextract_main does not currently use the os_access abstraction
|
EXPECT_EQ(0, t.run({"-i", "image.dwarfs", "-f", "mtree", "--perfmon",
|
||||||
auto exit_code = run({"-i", test_data_image.string(), "-f", "mtree",
|
"filesystem_v2,inode_reader_v2"}))
|
||||||
"--perfmon", "filesystem_v2,inode_reader_v2"});
|
<< t.err();
|
||||||
EXPECT_EQ(exit_code, 0);
|
auto outs = t.out();
|
||||||
auto outs = out();
|
auto errs = t.err();
|
||||||
auto errs = err();
|
|
||||||
EXPECT_GT(outs.size(), 100);
|
EXPECT_GT(outs.size(), 100);
|
||||||
EXPECT_FALSE(errs.empty());
|
EXPECT_FALSE(errs.empty());
|
||||||
EXPECT_THAT(errs, ::testing::HasSubstr("[filesystem_v2.readv_future]"));
|
EXPECT_THAT(errs, ::testing::HasSubstr("[filesystem_v2.readv_future]"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user