11.2Sjoerg# $NetBSD: t_atexit.sh,v 1.2 2017/07/10 21:43:33 joerg Exp $ 21.1Spgoyette# 31.1Spgoyette# Copyright (c) 2011 The NetBSD Foundation, Inc. 41.1Spgoyette# All rights reserved. 51.1Spgoyette# 61.1Spgoyette# Redistribution and use in source and binary forms, with or without 71.1Spgoyette# modification, are permitted provided that the following conditions 81.1Spgoyette# are met: 91.1Spgoyette# 1. Redistributions of source code must retain the above copyright 101.1Spgoyette# notice, this list of conditions and the following disclaimer. 111.1Spgoyette# 2. Redistributions in binary form must reproduce the above copyright 121.1Spgoyette# notice, this list of conditions and the following disclaimer in the 131.1Spgoyette# documentation and/or other materials provided with the distribution. 141.1Spgoyette# 151.1Spgoyette# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 161.1Spgoyette# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 171.1Spgoyette# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 181.1Spgoyette# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 191.1Spgoyette# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 201.1Spgoyette# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 211.1Spgoyette# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 221.1Spgoyette# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 231.1Spgoyette# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 241.1Spgoyette# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 251.1Spgoyette# POSSIBILITY OF SUCH DAMAGE. 261.1Spgoyette# 271.1Spgoyette 281.1Spgoyetteatf_test_case atexit 291.1Spgoyetteatexit_head() 301.1Spgoyette{ 311.1Spgoyette atf_set "descr" "Checks atexit(3) and __cxa_atexit()/__cxa_finalize()" 321.1Spgoyette} 331.1Spgoyetteatexit_body() 341.1Spgoyette{ 351.1Spgoyette $(atf_get_srcdir)/h_atexit >out \ 361.2Sjoerg || atf_fail "h_atexit failed, see output of the test for details" 371.1Spgoyette 381.1Spgoyette cat >exp <<EOF 391.1Spgoyettecxa_handler_5 401.1Spgoyettecxa_handler_4 411.1Spgoyettecxa_handler_3 421.1Spgoyettecxa_handler_2 431.1Spgoyettenormal_handler_1 441.1Spgoyettenormal_handler_0 451.1SpgoyetteEOF 461.1Spgoyette 471.1Spgoyette diff -Nru exp out \ 481.2Sjoerg || atf_fail "h_atexit failed, see output of the test for details" 491.1Spgoyette} 501.1Spgoyette 511.1Spgoyetteatf_init_test_cases() 521.1Spgoyette{ 531.1Spgoyette atf_add_test_case atexit 541.1Spgoyette} 55