Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/llfio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2016-06-04 21:55:32 +0300
committerNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2016-06-04 21:55:32 +0300
commit8e271b3d17b76f7f14ea0ecbf62d24b75f774af6 (patch)
treedaaf26e4242d744fe8c6ff37e94e31ea0ff0a369 /test/tests/file_handle_create_close
parentc8b061a46ef8f34cfe80f88b926c21966a13f503 (diff)
wip but good progress today
Diffstat (limited to 'test/tests/file_handle_create_close')
-rw-r--r--test/tests/file_handle_create_close/runner.cpp34
1 files changed, 21 insertions, 13 deletions
diff --git a/test/tests/file_handle_create_close/runner.cpp b/test/tests/file_handle_create_close/runner.cpp
index 3f0c05e2..332bec29 100644
--- a/test/tests/file_handle_create_close/runner.cpp
+++ b/test/tests/file_handle_create_close/runner.cpp
@@ -13,16 +13,18 @@ template <class U> inline void file_handle_create_close_creation(U &&f)
{
using namespace BOOST_KERNELTEST_V1_NAMESPACE;
using file_handle = BOOST_AFIO_V2_NAMESPACE::file_handle;
- /* For every one of these parameter values listed, test with the value using
- the input workspace which should produce outcome workspace. Workspaces are:
- * non-existing: no files
- * existing0: single zero length file
- * existing1: single one byte length file
+
+ /* Set up a permuter which for every one of these parameter values listed,
+ tests with the value using the input workspace which should produce outcome
+ workspace. Workspaces are:
+ * non-existing: no files
+ * existing0: single zero length file
+ * existing1: single one byte length file
*/
// clang-format off
- auto results = mt_permute_parameters< // This is a multithreaded parameter permutation test
- result<void>, // The output outcome/result/option type. Type void means we don't care about the return type.
- parameters< // The types of one or more input parameters to permute/fuzz the kernel with.
+ static const auto permuter = mt_permute_parameters< // This is a multithreaded parameter permutation test
+ result<void>, // The output outcome/result/option type. Type void means we don't care about the return type.
+ parameters< // The types of one or more input parameters to permute/fuzz the kernel with.
typename file_handle::creation
>,
// Any additional per-permute parameters not used to invoke the kernel
@@ -42,16 +44,22 @@ template <class U> inline void file_handle_create_close_creation(U &&f)
{ make_ready_result<void>(), { file_handle::creation::truncate }, { "existing1" }, { "existing0" }}
},
// Any parameters from now on are called before each permutation and the object returned is
- // destroyed after each permutation. The callspec is (parameter_permuter<...> *parent, outcome<T> &testret, pars)
+ // destroyed after each permutation. The callspec is (parameter_permuter<...> *parent, outcome<T> &testret, size_t, pars)
hooks::filesystem_setup("file_handle_create_close"), // Configure this filesystem workspace before the test
hooks::filesystem_comparison_inexact("file_handle_create_close") // Do an inexact comparison of the filesystem workspace after the test
- )
+ );
// clang-format on
- (std::forward<U>(f));
+
+ // Have the permuter permute callable f with all the permutations, returning outcomes
+ auto results = permuter(std::forward<U>(f));
+ std::vector<std::function<void()>> checks;
+
// Check each of the results. We don't do this inside the kernel as it messes with fuzzing/sanitising.
// We don't do this inside the parameter permuter either in case the fuzzer/sanitiser uses that.
- for(const auto &i : results)
- BOOST_KERNELTEST_CHECK_RESULT(i);
+ permuter.check(results, pretty_print_failure(permuter.parameter_sequence(), [&](const auto &result, const auto &shouldbe) { checks.push_back([&] { BOOST_CHECK(result == shouldbe); }); }));
+
+ for(auto &i : checks)
+ i();
}
BOOST_KERNELTEST_TEST_KERNEL(integration, afio, file_handle_create_close, file_handle, "Tests that afio::file_handle's creation parameter works as expected", file_handle_create_close_creation(file_handle_create_close::test_kernel_file_handle))