a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt// Copyright (c) 2007 The NetBSD Foundation, Inc.
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt// All rights reserved.
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt// Redistribution and use in source and binary forms, with or without
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt// modification, are permitted provided that the following conditions
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt// 1. Redistributions of source code must retain the above copyright
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt// notice, this list of conditions and the following disclaimer.
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt// 2. Redistributions in binary form must reproduce the above copyright
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt// notice, this list of conditions and the following disclaimer in the
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt// documentation and/or other materials provided with the distribution.
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews#include "atf-c++/utils.hpp"
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Huntatf::utils::cat_file(const std::string& path, const std::string& prefix)
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Huntatf::utils::copy_file(const std::string& source, const std::string& destination)
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt atf_utils_copy_file(source.c_str(), destination.c_str());
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Huntatf::utils::compare_file(const std::string& path, const std::string& contents)
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt return atf_utils_compare_file(path.c_str(), contents.c_str());
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Huntatf::utils::create_file(const std::string& path, const std::string& contents)
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt atf_utils_create_file(path.c_str(), "%s", contents.c_str());
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Huntatf::utils::grep_file(const std::string& regex, const std::string& path)
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt return atf_utils_grep_file("%s", path.c_str(), regex.c_str());
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Huntatf::utils::grep_string(const std::string& regex, const std::string& str)
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt return atf_utils_grep_string("%s", str.c_str(), regex.c_str());
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Huntatf::utils::redirect(const int fd, const std::string& path)
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Huntatf::utils::wait(const pid_t pid, const int exitstatus,
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt const std::string& expout, const std::string& experr)