-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix TypeError when running get_rpaths on rez.utils.elf module (#1798)
Signed-off-by: Ruzette Krukkert <[email protected]> Signed-off-by: Jean-Christophe Morin <[email protected]> Co-authored-by: Jean-Christophe Morin <[email protected]>
- Loading branch information
1 parent
9c27f5e
commit 3d0f224
Showing
3 changed files
with
42 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright Contributors to the Rez Project | ||
|
||
|
||
""" | ||
unit tests for 'rez.utils.elf' module | ||
""" | ||
import platform | ||
import unittest | ||
|
||
from rez.tests.util import TestBase, program_dependent | ||
from rez.utils.elf import get_rpaths, patch_rpaths | ||
|
||
|
||
class TestElfUtils(TestBase): | ||
|
||
def __init__(self, *nargs, **kwargs): | ||
super().__init__(*nargs, **kwargs) | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
|
||
@classmethod | ||
def tearDownClass(cls): | ||
super().tearDownClass() | ||
|
||
@unittest.skipUnless(platform.system() == "Linux", "Linux only") | ||
@program_dependent("readelf") | ||
def test_get_rpaths_raises_runtime_exception(self): | ||
"""Tests that no TypeError from elf functions are raised.""" | ||
with self.assertRaises(RuntimeError) as exc: | ||
get_rpaths("/path/to/elfpath") | ||
self.assertIn("'/path/to/elfpath': No such file", str(exc.exception)) | ||
|
||
with self.assertRaises(RuntimeError) as exc: | ||
patch_rpaths("/path/to/elfpath", ["$ORIGIN", "$ORIGINTEST"]) | ||
self.assertIn("'/path/to/elfpath': No such file", str(exc.exception)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters