1// 2// Automated Testing Framework (atf) 3// 4// Copyright (c) 2007, 2008, 2009, 2010 The NetBSD Foundation, Inc. 5// All rights reserved. 6// 7// Redistribution and use in source and binary forms, with or without 8// modification, are permitted provided that the following conditions 9// are met: 10// 1. Redistributions of source code must retain the above copyright 11// notice, this list of conditions and the following disclaimer. 12// 2. Redistributions in binary form must reproduce the above copyright 13// notice, this list of conditions and the following disclaimer in the 14// documentation and/or other materials provided with the distribution. 15// 16// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND 17// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 18// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY 21// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 23// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 26// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28// 29 30#if !defined(_ATF_REPORT_FORMATS_HPP_) 31#define _ATF_REPORT_FORMATS_HPP_ 32 33#include <istream> 34#include <string> 35 36#include <atf-c++/tests.hpp> 37 38namespace atf { 39namespace atf_report { 40 41struct test_case_result { 42 enum state_enum { 43 PASSED, 44 FAILED, 45 SKIPPED, 46 }; 47 const state_enum state; 48 const std::string& reason; 49 50 test_case_result(const state_enum p_state, const std::string& p_reason) : 51 state(p_state), 52 reason(p_reason) 53 { 54 } 55}; 56 57class atf_tps_reader { 58 std::istream& m_is; 59 60 void read_info(void*); 61 void read_tp(void*); 62 void read_tc(void*); 63 64protected: 65 virtual void got_info(const std::string&, const std::string&); 66 virtual void got_ntps(size_t); 67 virtual void got_tp_start(const std::string&, size_t); 68 virtual void got_tp_end(const std::string&); 69 70 virtual void got_tc_start(const std::string&); 71 virtual void got_tc_stdout_line(const std::string&); 72 virtual void got_tc_stderr_line(const std::string&); 73 virtual void got_tc_end(const std::string&, const std::string&); 74 virtual void got_eof(void); 75 76public: 77 atf_tps_reader(std::istream&); 78 virtual ~atf_tps_reader(void); 79 80 void read(void); 81}; 82 83} // namespace atf_report 84} // namespace atf 85 86#endif // !defined(_ATF_REPORT_FORMATS_HPP_) 87