Skip to content

Commit

Permalink
fix pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
universalmind303 committed Feb 9, 2024
1 parent 1439983 commit e6c0dac
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions tests/tests/test_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pytest
import psycopg2

from fixtures.glaredb import glaredb_connection, release_path, debug_path


def test_release_exists(release_path: pathlib.Path):
Expand All @@ -27,19 +28,15 @@ def test_start(
cur.execute("SELECT 1;")


@pytest.mark.skipif(
not sys.platform.startswith("linux"), reason="linux version of the test"
)
@pytest.mark.skipif(not sys.platform.startswith("linux"), reason="linux version of the test")
def test_expected_linking_linux(debug_path: pathlib.Path):
out = [
ll
for cell in [
item
for item in [
line.split(" ")
for line in str(
subprocess.check_output(["ldd", debug_path.absolute()], text=True)
)
for line in str(subprocess.check_output(["ldd", debug_path.absolute()], text=True))
.replace("\t", "")
.split("\n")
]
Expand Down Expand Up @@ -72,25 +69,21 @@ def test_expected_linking_linux(debug_path: pathlib.Path):
if lib.startswith(prefix):
pending += 1

assert expected == 3, (
f"missing expected library {expected_prefix} in:\n" + "\n".join(out)
)
assert expected == 3, f"missing expected library {expected_prefix} in:\n" + "\n".join(out)

# this is hella gross, but this number will change any time we add
# a new library, this assertion will fail.
#
# it's two numbers because this is different on different distros;
# as long as we don't have two numbers next to eachother this is fine;
# presently: (ubuntu2004, archlinux)
assert len(out) == (expected + possible + pending), (
"unexpected library in:\n" + "\n".join(out)
)
assert len(out) == (expected + possible + pending), "unexpected library in:\n" + "\n".join(out)

# TODO: currently we link (open) libssl, which means the first time it
# changes uncomment the first assertion in the loop below and
# remove this comment:

for lib in out:
# assert not ("ssl" in lib)
assert "libc++" not in lib
assert "libstdc++" not in lib
assert not ("libc++" in lib)
assert not ("libstdc++" in lib)

0 comments on commit e6c0dac

Please sign in to comment.