def test_local_elf_interp_install(self): """ Makes sure that we link to the installed interp if there is one. """ # This is a slight hack, but lets pre-create seed the environment with # our symlink ld.so so that it is the link target interp_path = linux.readelf_interp(sys.executable) lib_dir = os.path.join(self.env_dir, 'lib') target_path = os.path.join(lib_dir, 'ld-2.99.so') util.ensure_dir(lib_dir) os.symlink(interp_path, target_path) # Create out environment self._make_empty_env() # Run the install self._xpkg_cmd(['install', 'basic', '--tree', self.tree_dir]) # Make sure it has the proper elf interp basic_bin = os.path.join(self.env_dir, 'bin', 'basic') interp_path = linux.readelf_interp(basic_bin) expected = os.path.join(self.env_dir, 'lib', 'ld-linux-xpkg.so') self.assertEquals(expected, interp_path) # Make sure it points to our special one linked_path = os.readlink(interp_path) self.assertEquals(target_path, linked_path)
def test_local_elf_interp(self): """ Makes sure we have a custom elf interp that links to the system one. """ # Run the install self._xpkg_cmd(['install', 'basic', '--tree', self.tree_dir]) # Make sure the program exists basic_bin = os.path.join(self.env_dir, 'bin', 'basic') self.assertPathExists(basic_bin) # Run our program to make sure it works output = util.shellcmd([basic_bin], shell=False, stream=False) self.assertEqual('Hello, world!\n', output) # Now make sure it has the proper elf interp expected = os.path.join(self.env_dir, 'lib', 'ld-linux-xpkg.so') interp_path = linux.readelf_interp(basic_bin) self.assertEquals(expected, interp_path)