Files
nvdriver/tools/run_live_control.py
nvidia-driver-rs 4526e6a816 Baseline: validated 30/30 tree with passing Level 7 hardware regression
- Updated tools/post_reboot.sh to check kernel oops taint bit and stuck driver tasks instead of <86400s uptime
- Level 7 hardware regression passed on 0000:b3:00.0 (module 37e6fa430835eee2b426019db3ad70eeb7a9e9070c09c84bd9b973cf56cbe529, 107 inventory words, 0 static mismatches, CUDA baseline verified before and after)
- Updated .gitignore to exclude build archives (*.a, *.rlib), __pycache__, and raw trace dumps
2026-11-23 23:48:38 +00:00

34 lines
2.6 KiB
Python

#!/usr/bin/env python3
"""Load only the isolated empty-target control module and record actual exits."""
from pathlib import Path
import subprocess,json,hashlib,os
R=Path(__file__).resolve().parent.parent
if os.geteuid()!=0:raise SystemExit('Run with sudo; test node is root-only')
module=R/'kernel-open/nvidia_rs.ko';module_sys=Path('/sys/module/nvidia_rs')
if module_sys.exists():raise SystemExit('Refusing to replace an already loaded module')
def bindings():
d={}
for f in Path('/sys/bus/pci/devices').iterdir():
try:
if (f/'vendor').read_text().strip()=='0x10de' and int((f/'class').read_text(),16)>>16==3:
d[f.name]={'driver':(f/'driver').resolve().name if (f/'driver').exists() else None,'device':(f/'device').read_text().strip()}
except OSError:pass
return d
before=bindings();runs=[];loaded=False;failure=None
report={'scope':'Live isolated control tests with empty pci_target. No GPU binding or DMA activation.','module_sha256':hashlib.sha256(module.read_bytes()).hexdigest(),'pci_before':before}
try:
r=subprocess.run(['insmod',str(module),'pci_target='],capture_output=True,text=True,timeout=30);runs.append({'command':'insmod','exit_code':r.returncode,'stderr':r.stderr});r.check_returncode();loaded=True
report['pci_target']=(module_sys/'parameters/pci_target').read_text().strip();assert report['pci_target']==''
for command in [[str(R/'target/compat32-rust-driver')],['/usr/bin/python3',str(R/'tools/live_control_test.py')],['/usr/bin/python3',str(R/'tools/probe_original_clients.py'),'/dev/nvidia-rsctl'],['/usr/bin/python3',str(R/'tools/probe_original_software_controls_replay.py')]]:
r=subprocess.run(command,capture_output=True,text=True,timeout=30,env={**os.environ,'NV_RS_NODE':'/dev/nvidia-rsctl'});
if command[-1].endswith('probe_original_software_controls_replay.py') and r.returncode==0:
(R/'reports/software-controls-rust-live.json').write_text(json.dumps(json.loads(r.stdout),indent=2)+'\n')
runs.append({'command':command,'exit_code':r.returncode,'stdout':r.stdout,'stderr':r.stderr});r.check_returncode()
except BaseException as e:failure=str(e)
finally:
if loaded:
r=subprocess.run(['rmmod','nvidia_rs'],capture_output=True,text=True,timeout=30);runs.append({'command':'rmmod','exit_code':r.returncode,'stderr':r.stderr})
report.update(runs=runs,error=failure,pci_after=bindings(),module_unloaded=not module_sys.exists())
report['passed']=failure is None and all(r['exit_code']==0 for r in runs) and report['module_unloaded'] and report['pci_before']==report['pci_after']
print(json.dumps(report,indent=2));raise SystemExit(0 if report['passed'] else 1)