1219820Sjeff// 2219820Sjeff// Automated Testing Framework (atf) 3219820Sjeff// 4219820Sjeff// Copyright (c) 2007 The NetBSD Foundation, Inc. 5219820Sjeff// All rights reserved. 6219820Sjeff// 7219820Sjeff// Redistribution and use in source and binary forms, with or without 8219820Sjeff// modification, are permitted provided that the following conditions 9219820Sjeff// are met: 10219820Sjeff// 1. Redistributions of source code must retain the above copyright 11219820Sjeff// notice, this list of conditions and the following disclaimer. 12219820Sjeff// 2. Redistributions in binary form must reproduce the above copyright 13219820Sjeff// notice, this list of conditions and the following disclaimer in the 14219820Sjeff// documentation and/or other materials provided with the distribution. 15219820Sjeff// 16219820Sjeff// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND 17219820Sjeff// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 18219820Sjeff// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19219820Sjeff// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20219820Sjeff// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY 21219820Sjeff// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22219820Sjeff// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 23219820Sjeff// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24219820Sjeff// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25219820Sjeff// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 26219820Sjeff// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27219820Sjeff// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28219820Sjeff// 29219820Sjeff 30219820Sjeff#if !defined(TOOLS_FORMATS_HPP) 31219820Sjeff#define TOOLS_FORMATS_HPP 32219820Sjeff 33219820Sjeffextern "C" { 34219820Sjeff#include <sys/time.h> 35219820Sjeff} 36219820Sjeff 37219820Sjeff#include <istream> 38219820Sjeff#include <string> 39219820Sjeff 40219820Sjeffnamespace tools { 41219820Sjeffnamespace atf_report { 42219820Sjeff 43219820Sjeffstruct test_case_result { 44219820Sjeff enum state_enum { 45219820Sjeff PASSED, 46219820Sjeff FAILED, 47219820Sjeff SKIPPED, 48219820Sjeff }; 49219820Sjeff const state_enum state; 50219820Sjeff const std::string& reason; 51219820Sjeff 52219820Sjeff test_case_result(const state_enum p_state, const std::string& p_reason) : 53219820Sjeff state(p_state), 54219820Sjeff reason(p_reason) 55219820Sjeff { 56219820Sjeff } 57219820Sjeff}; 58219820Sjeff 59219820Sjeffclass atf_tps_reader { 60219820Sjeff std::istream& m_is; 61219820Sjeff 62219820Sjeff void read_info(void*); 63219820Sjeff void read_tp(void*); 64219820Sjeff void read_tc(void*); 65219820Sjeff 66219820Sjeffprotected: 67219820Sjeff virtual void got_info(const std::string&, const std::string&); 68219820Sjeff virtual void got_ntps(size_t); 69219820Sjeff virtual void got_tp_start(const std::string&, size_t); 70219820Sjeff virtual void got_tp_end(struct timeval*, const std::string&); 71219820Sjeff 72219820Sjeff virtual void got_tc_start(const std::string&); 73219820Sjeff virtual void got_tc_stdout_line(const std::string&); 74219820Sjeff virtual void got_tc_stderr_line(const std::string&); 75219820Sjeff virtual void got_tc_end(const std::string&, struct timeval*, 76219820Sjeff const std::string&); 77219820Sjeff virtual void got_eof(void); 78219820Sjeff 79219820Sjeffpublic: 80278886Shselasky atf_tps_reader(std::istream&); 81278886Shselasky virtual ~atf_tps_reader(void); 82278886Shselasky 83278886Shselasky void read(void); 84278886Shselasky}; 85278886Shselasky 86278886Shselasky} // namespace atf_report 87278886Shselasky} // namespace tools 88278886Shselasky 89219820Sjeff#endif // !defined(TOOLS_FORMATS_HPP) 90219820Sjeff