Home | History | Annotate | Line # | Download | only in share
atf-run.hooks revision 1.1.1.1.4.2
      1  1.1.1.1.4.2  yamt #
      2  1.1.1.1.4.2  yamt # Automated Testing Framework (atf)
      3  1.1.1.1.4.2  yamt #
      4  1.1.1.1.4.2  yamt # Copyright (c) 2007 The NetBSD Foundation, Inc.
      5  1.1.1.1.4.2  yamt # All rights reserved.
      6  1.1.1.1.4.2  yamt #
      7  1.1.1.1.4.2  yamt # Redistribution and use in source and binary forms, with or without
      8  1.1.1.1.4.2  yamt # modification, are permitted provided that the following conditions
      9  1.1.1.1.4.2  yamt # are met:
     10  1.1.1.1.4.2  yamt # 1. Redistributions of source code must retain the above copyright
     11  1.1.1.1.4.2  yamt #    notice, this list of conditions and the following disclaimer.
     12  1.1.1.1.4.2  yamt # 2. Redistributions in binary form must reproduce the above copyright
     13  1.1.1.1.4.2  yamt #    notice, this list of conditions and the following disclaimer in the
     14  1.1.1.1.4.2  yamt #    documentation and/or other materials provided with the distribution.
     15  1.1.1.1.4.2  yamt #
     16  1.1.1.1.4.2  yamt # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
     17  1.1.1.1.4.2  yamt # CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
     18  1.1.1.1.4.2  yamt # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     19  1.1.1.1.4.2  yamt # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     20  1.1.1.1.4.2  yamt # IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
     21  1.1.1.1.4.2  yamt # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     22  1.1.1.1.4.2  yamt # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
     23  1.1.1.1.4.2  yamt # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     24  1.1.1.1.4.2  yamt # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
     25  1.1.1.1.4.2  yamt # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     26  1.1.1.1.4.2  yamt # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
     27  1.1.1.1.4.2  yamt # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     28  1.1.1.1.4.2  yamt #
     29  1.1.1.1.4.2  yamt 
     30  1.1.1.1.4.2  yamt atf_tps_writer_info()
     31  1.1.1.1.4.2  yamt {
     32  1.1.1.1.4.2  yamt     class=${1}; shift
     33  1.1.1.1.4.2  yamt     echo "info: ${class}, $*"
     34  1.1.1.1.4.2  yamt }
     35  1.1.1.1.4.2  yamt 
     36  1.1.1.1.4.2  yamt info_start_hook()
     37  1.1.1.1.4.2  yamt {
     38  1.1.1.1.4.2  yamt     default_info_start_hook "${@}"
     39  1.1.1.1.4.2  yamt }
     40  1.1.1.1.4.2  yamt 
     41  1.1.1.1.4.2  yamt default_info_start_hook()
     42  1.1.1.1.4.2  yamt {
     43  1.1.1.1.4.2  yamt     atf_tps_writer_info "atf.version" $(atf-version | head -n 1)
     44  1.1.1.1.4.2  yamt 
     45  1.1.1.1.4.2  yamt     atf_tps_writer_info "tests.root" $(pwd)
     46  1.1.1.1.4.2  yamt 
     47  1.1.1.1.4.2  yamt     atf_tps_writer_info "time.start" $(date)
     48  1.1.1.1.4.2  yamt 
     49  1.1.1.1.4.2  yamt     atf_tps_writer_info "uname.sysname" $(uname -s)
     50  1.1.1.1.4.2  yamt     atf_tps_writer_info "uname.nodename" $(uname -n)
     51  1.1.1.1.4.2  yamt     atf_tps_writer_info "uname.release" $(uname -r)
     52  1.1.1.1.4.2  yamt     atf_tps_writer_info "uname.version" $(uname -v)
     53  1.1.1.1.4.2  yamt     atf_tps_writer_info "uname.machine" $(uname -m)
     54  1.1.1.1.4.2  yamt 
     55  1.1.1.1.4.2  yamt     # Add all the environment variables to the report.  We have to be
     56  1.1.1.1.4.2  yamt     # careful with those that span over multiple lines; otherwise their
     57  1.1.1.1.4.2  yamt     # values could be printed as multiple different variables (one per
     58  1.1.1.1.4.2  yamt     # line), which is incorrect.
     59  1.1.1.1.4.2  yamt     oldifs="${IFS}"
     60  1.1.1.1.4.2  yamt     IFS='
     61  1.1.1.1.4.2  yamt '
     62  1.1.1.1.4.2  yamt     set -- $(env)
     63  1.1.1.1.4.2  yamt     val=${1}; shift
     64  1.1.1.1.4.2  yamt     while [ ${#} -gt 0 ]; do
     65  1.1.1.1.4.2  yamt         if echo "${1}" | grep '^[a-zA-Z0-0_][a-zA-Z0-9_]*=' >/dev/null; then
     66  1.1.1.1.4.2  yamt             atf_tps_writer_info "env" "${val}"
     67  1.1.1.1.4.2  yamt             val="${1}"
     68  1.1.1.1.4.2  yamt         else
     69  1.1.1.1.4.2  yamt             val="${val} ${1}"
     70  1.1.1.1.4.2  yamt         fi
     71  1.1.1.1.4.2  yamt         shift
     72  1.1.1.1.4.2  yamt     done
     73  1.1.1.1.4.2  yamt     atf_tps_writer_info "env" "${val}"
     74  1.1.1.1.4.2  yamt     IFS="${oldifs}"
     75  1.1.1.1.4.2  yamt }
     76  1.1.1.1.4.2  yamt 
     77  1.1.1.1.4.2  yamt info_end_hook()
     78  1.1.1.1.4.2  yamt {
     79  1.1.1.1.4.2  yamt     default_info_end_hook "${@}"
     80  1.1.1.1.4.2  yamt }
     81  1.1.1.1.4.2  yamt 
     82  1.1.1.1.4.2  yamt default_info_end_hook()
     83  1.1.1.1.4.2  yamt {
     84  1.1.1.1.4.2  yamt     atf_tps_writer_info "time.end" $(date)
     85  1.1.1.1.4.2  yamt }
     86  1.1.1.1.4.2  yamt 
     87  1.1.1.1.4.2  yamt sitehooks=$(atf-config -t atf_confdir)/atf-run.hooks
     88  1.1.1.1.4.2  yamt userhooks=${HOME}/.atf/atf-run.hooks
     89  1.1.1.1.4.2  yamt [ -f ${sitehooks} ] && . ${sitehooks}
     90  1.1.1.1.4.2  yamt [ -f ${userhooks} ] && . ${userhooks}
     91  1.1.1.1.4.2  yamt 
     92  1.1.1.1.4.2  yamt eval ${1}
     93  1.1.1.1.4.2  yamt 
     94  1.1.1.1.4.2  yamt # vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4
     95