Skip to contentSkip to conversation

master - test: Split up the new runner into multiple files.

PATCH Petr Rockai 1 participant 1 message Feb 5, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9dfbce0aa72735048a788dd23f91f76fbc21dd23
Commit:        9dfbce0aa72735048a788dd23f91f76fbc21dd23
Parent:        b726d6688260e1e1e98500809eee014b7ceb92b5
Author:        Petr Rockai <[email protected]>
AuthorDate:    Wed Jun 25 21:34:34 2014 +0200
Committer:     Petr Rockai <[email protected]>
CommitterDate: Thu Feb 5 13:47:16 2015 +0100

test: Split up the new runner into multiple files.

---
 test/Makefile.in      |    4 +-
 test/lib/filesystem.h |   86 ++++++++++++++++
 test/lib/io.h         |  211 +++++++++++++++++++++++++++++++++++++++
 test/lib/journal.h    |   58 +++++++++++
 test/lib/runner.cpp   |  265 ++++++++-----------------------------------------
 test/lib/util.h       |   39 +++++++
 6 files changed, 437 insertions(+), 226 deletions(-)
test/Makefile.in +2 -2
index c88d07a..88644f3 100644
@@ -38,7 +38,6 @@ export LVM_TEST_CACHE_RESTORE_CMD?=@CACHE_RESTORE_CMD@
 SUBDIRS = api unit
 SOURCES = lib/not.c lib/harness.c
 CXXSOURCES = lib/runner.cpp
-CXXFLAGS = -std=c++11
 
 include $(top_builddir)/make.tmpl
 
@@ -137,10 +136,11 @@ lib/invalid: lib/not
 lib/fail: lib/not
 	ln -sf not lib/fail
 
-
 lib/runner: lib/runner.o .lib-dir-stamp
 	$(CXX) $(LDFLAGS) -o $@ $<
 
+lib/runner.o: $(wildcard $(srcdir)/lib/*.h)
+
 lib/%: lib/%.o .lib-dir-stamp
 	$(CC) $(LDFLAGS) -o $@ $<
 
test/lib/filesystem.h new file +86 -0

86 lines not on this page · raw message

test/lib/io.h new file +211 -0

211 lines not on this page · raw message

test/lib/journal.h new file +58 -0

58 lines not on this page · raw message

test/lib/runner.cpp +41 -224

343 lines not on this page · raw message

test/lib/util.h new file +39 -0
new file mode 100644
index 0000000..1450ab4
@@ -0,0 +1,39 @@
+/* -*- C++ -*- copyright (c) 2014 Red Hat, Inc.
+ *
+ * This file is part of LVM2.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdexcept>
+#include <cstring>
+#include <errno.h>
+
+#ifndef RUNNER_UTIL_H
+#define RUNNER_UTIL_H
+
+inline std::runtime_error syserr( std::string msg, std::string ctx = "" ) {
+	return std::runtime_error( std::string( strerror( errno ) ) + " " + msg + " " + ctx );
+}
+
+#endif