aboutsummaryrefslogtreecommitdiff
path: root/test/test_runner.cc
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-17 00:27:43 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-17 00:27:43 +0000
commit103e5770f120d70b1580bfc3cab8219c6608bc21 (patch)
tree55d04f6fbf26db1698fb12264ac3b86c40455187 /test/test_runner.cc
downloadpaludis-103e5770f120d70b1580bfc3cab8219c6608bc21.tar.gz
paludis-103e5770f120d70b1580bfc3cab8219c6608bc21.tar.xz
Initial import
Diffstat (limited to 'test/test_runner.cc')
-rw-r--r--test/test_runner.cc55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/test_runner.cc b/test/test_runner.cc
new file mode 100644
index 000000000..1aa74ab4c
--- /dev/null
+++ b/test/test_runner.cc
@@ -0,0 +1,55 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "test_runner.hh"
+
+#include "test_runner.hh"
+#include "test_framework.hh"
+#include <iostream>
+#include <cstdlib>
+#include <signal.h>
+#include <unistd.h>
+
+/** \file
+ * Implementation of the default test runner.
+ *
+ * \ingroup Test
+ */
+
+using namespace test;
+
+/**
+ * Called if we take too long.
+ */
+void
+timeout_handler(int)
+{
+ std::cerr << "Exiting due to timeout!" << std::endl;
+ std::exit(EXIT_FAILURE);
+}
+
+int
+main(int, char * argv[])
+{
+ signal(SIGALRM, &timeout_handler);
+ std::cout << "Test program " << argv[0] << ":" << std::endl;
+ return TestCaseList::run_tests() ? EXIT_SUCCESS : EXIT_FAILURE;
+}
+