t_elf.py revision 2721
abc834c020080fe44a1ea4e34278327e99e3e12eEugen Kuksa# CDDL HEADER START
abc834c020080fe44a1ea4e34278327e99e3e12eEugen Kuksa# The contents of this file are subject to the terms of the
f0264afd33a980b6584747fc8159ee950805d9e3Eugen Kuksa# Common Development and Distribution License (the "License").
f0264afd33a980b6584747fc8159ee950805d9e3Eugen Kuksa# You may not use this file except in compliance with the License.
f0264afd33a980b6584747fc8159ee950805d9e3Eugen Kuksa# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
f0264afd33a980b6584747fc8159ee950805d9e3Eugen Kuksa# See the License for the specific language governing permissions
f0264afd33a980b6584747fc8159ee950805d9e3Eugen Kuksa# and limitations under the License.
f0264afd33a980b6584747fc8159ee950805d9e3Eugen Kuksa# When distributing Covered Code, include this CDDL HEADER in each
f0264afd33a980b6584747fc8159ee950805d9e3Eugen Kuksa# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
f0264afd33a980b6584747fc8159ee950805d9e3Eugen Kuksa# If applicable, add the following below this CDDL HEADER, with the
f0264afd33a980b6584747fc8159ee950805d9e3Eugen Kuksa# fields enclosed by brackets "[]" replaced with your own identifying
f0264afd33a980b6584747fc8159ee950805d9e3Eugen Kuksa# information: Portions Copyright [yyyy] [name of copyright owner]
f0264afd33a980b6584747fc8159ee950805d9e3Eugen Kuksa# CDDL HEADER END
f0264afd33a980b6584747fc8159ee950805d9e3Eugen Kuksa# Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
f0264afd33a980b6584747fc8159ee950805d9e3Eugen Kuksa # If something in this list does not exist, the test_valid_elf
f0264afd33a980b6584747fc8159ee950805d9e3Eugen Kuksa # tests may fail. At some point if someone moves paths around in
b51057b860560bf3ee454c03a121af3d5d34f482Eugen Kuksa # ON, this might fail. Sorry!
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksa """Test that elf routines gracefully handle non-elf objects."""
a8028fd2789e323040de08827a0fe1f7d36fde2bEugen Kuksa p = "this-is-not-an-elf-file.so"
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksa self.make_misc_files({p: "this is only a test"})
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksa self.assertRaises(elf.ElfError, elf.get_dynamic, p)
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksa self.assertRaises(elf.ElfError, elf.get_info, p)
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksa """Test that elf routines gracefully handle ENOENT."""
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksa self.assertRaises(OSError, elf.is_elf_object, p)
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksa """Test that elf routines work on a small set of objects."""