projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8b38c35
)
Use empty files where possible to speed things up a lot.
author
Carl Hetherington
<cth@carlh.net>
Mon, 20 Jun 2022 09:38:58 +0000
(11:38 +0200)
committer
Carl Hetherington
<cth@carlh.net>
Tue, 21 Jun 2022 16:55:16 +0000
(18:55 +0200)
test/disk_writer_test.cc
patch
|
blob
|
history
diff --git
a/test/disk_writer_test.cc
b/test/disk_writer_test.cc
index a27da0c5f17999774e96e6ce4b60a888b077c039..dae991e5870ba34f0bf0ea2928cd844df14e6a23 100644
(file)
--- a/
test/disk_writer_test.cc
+++ b/
test/disk_writer_test.cc
@@
-58,6
+58,18
@@
ext2_ls (vector<string> arguments)
}
}
+static
+void
+make_empty_file(boost::filesystem::path file, off_t size)
+{
+ auto fd = open (file.string().c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
+ BOOST_REQUIRE (fd != -1);
+ auto const r = posix_fallocate (fd, 0, size);
+ BOOST_REQUIRE_EQUAL (r, 0);
+ close (fd);
+}
+
+
/** Use the writer code to make a disk and partition and copy a file (in a directory)
* to it, then check that:
* - the partition has inode size 128
/** Use the writer code to make a disk and partition and copy a file (in a directory)
* to it, then check that:
* - the partition has inode size 128
@@
-147,8
+159,9
@@
BOOST_AUTO_TEST_CASE (disk_writer_test2)
cl.add(disk);
cl.add(partition);
cl.add(disk);
cl.add(partition);
- make_random_file(disk, 31043616768LL);
- make_random_file(partition, 31043571712LL);
+ /* Using empty files here still triggers the bug and is much quicker than using random data */
+ make_empty_file(disk, 31043616768LL);
+ make_empty_file(partition, 31043571712LL);
auto const dcp = TestPaths::private_data() / "xm";
dcpomatic::write(dcp, disk.string(), partition.string(), nullptr);
auto const dcp = TestPaths::private_data() / "xm";
dcpomatic::write(dcp, disk.string(), partition.string(), nullptr);