From a548e5f5d133aef047ce5aa1d61578239bd02fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?= Date: Wed, 29 Jul 2020 13:00:19 -0700 Subject: [PATCH] test: Mark tmpdir::remove noexcept MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also disable the allocation failure injection in it. Refs #6831. Signed-off-by: Rafael Ávila de Espíndola Message-Id: <20200729200019.250908-2-espindola@scylladb.com> --- test/lib/tmpdir.cc | 9 ++++++++- test/lib/tmpdir.hh | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/test/lib/tmpdir.cc b/test/lib/tmpdir.cc index 7c123ea87f..98c6d0628d 100644 --- a/test/lib/tmpdir.cc +++ b/test/lib/tmpdir.cc @@ -21,7 +21,14 @@ #include "test/lib/tmpdir.hh" -void tmpdir::remove() { +#include + +// This is not really noexcept. But it is used only from the +// destructor and move assignment operators which have to be +// noexcept. This is only for testing, so a std::unexpected call if if +// remove fails is fine. +void tmpdir::remove() noexcept { + memory::disable_failure_guard dfg; if (!_path.empty()) { fs::remove_all(_path); } diff --git a/test/lib/tmpdir.hh b/test/lib/tmpdir.hh index b92b99e0ca..150ef2f8d8 100644 --- a/test/lib/tmpdir.hh +++ b/test/lib/tmpdir.hh @@ -35,7 +35,7 @@ class tmpdir { fs::path _path; private: - void remove(); + void remove() noexcept; public: tmpdir();