Skip to content

Commit 218f26d

Browse files
committed
smoke test: show cpuinfo
1 parent efda6e0 commit 218f26d

2 files changed

Lines changed: 30 additions & 2 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ repos:
3737
files: \.py$
3838
verbose: true
3939
entry: env PYTHONPATH=bindings/python pylint
40-
args: [-d, "bad-continuation,global-statement,missing-docstring,missing-module-docstring,line-too-long,too-many-arguments,duplicate-code,redefined-outer-name,too-many-locals,bare-except,broad-except,import-outside-toplevel,protected-access,too-many-statements"]
40+
args: [-d, "bad-continuation,global-statement,missing-docstring,missing-module-docstring,line-too-long,too-many-arguments,duplicate-code,redefined-outer-name,too-many-locals,bare-except,broad-except,import-outside-toplevel,protected-access,too-many-statements,too-many-branches"]

test/genomicsqlite_smoke_test.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import sys
77
import time
88
import os
9+
import subprocess
910
import traceback
1011
import platform
1112
import textwrap
@@ -20,6 +21,33 @@ def main():
2021
python: {platform.python_implementation()} {platform.python_version()}"""
2122
print(textwrap.dedent(header))
2223

24+
print("cpu", end="")
25+
try:
26+
if platform.system() == "Linux":
27+
with open("/proc/cpuinfo") as cpuinfo:
28+
modelname = (
29+
line.strip().replace("\t", "")
30+
for line in cpuinfo
31+
if line.lower().strip().startswith("model name")
32+
)
33+
print(" " + next(modelname, ": ???"))
34+
elif platform.system() == "Darwin":
35+
sysctl = subprocess.run(
36+
["sysctl", "-n", "machdep.cpu.brand_string"],
37+
check=True,
38+
universal_newlines=True,
39+
stdout=subprocess.PIPE,
40+
stderr=subprocess.PIPE,
41+
)
42+
if sysctl.returncode == 0 and sysctl.stdout.strip():
43+
print(": " + sysctl.stdout.strip())
44+
else:
45+
print(": ???")
46+
else:
47+
print(": ???")
48+
except Exception:
49+
print(": ???")
50+
2351
env_keys = [
2452
k
2553
for k in os.environ
@@ -103,7 +131,7 @@ def main():
103131
print(" " + str(expl))
104132

105133
print(
106-
"\n** WARNING: GRI yielded correct results, but possibly with a suboptimal query plan."
134+
"\n** WARNING: GRI yielded correct results, but with a possibly suboptimal query plan."
107135
)
108136
print(
109137
"** Please redirect this log to a file and send to maintainers @ https://github.com/mlin/GenomicSQLite\n"

0 commit comments

Comments
 (0)