| 1 | #!/usr/bin/env python3 |
| 2 | """Run the notebook-structure lane against a disposable Linux lab VM's Samba share.""" |
| 3 | import argparse |
| 4 | import os |
| 5 | from pathlib import Path |
| 6 | import subprocess |
| 7 | import sys |
| 8 | |
| 9 | sys.path.insert(0, str(Path(__file__).resolve().parent / 'w7')) |
| 10 | from linux_vm import load_instance |
| 11 | |
| 12 | |
| 13 | def main(): |
| 14 | parser = argparse.ArgumentParser(description=__doc__) |
| 15 | parser.add_argument('vm', help='An already running, caller-owned Linux lab VM') |
| 16 | parser.add_argument('output', type=Path) |
| 17 | args = parser.parse_args() |
| 18 | output = args.output.resolve() |
| 19 | output.mkdir(parents=True, exist_ok=False) |
| 20 | config = load_instance(args.vm) |
| 21 | env = dict(os.environ, ONESTORE_SMB_LAB=f'127.0.0.1:{config["samba_port"]}') |
| 22 | with (output / 'structure.log').open('w') as result: |
| 23 | subprocess.run(['cargo', 'test', '-p', 'notebook', '--features', 'smb', 'smb::tests::live_structure', '--', '--ignored', '--exact'], |
| 24 | env=env, stdout=result, stderr=result, check=True, timeout=600) |
| 25 | print('structure: passed', flush=True) |
| 26 | |
| 27 | |
| 28 | if __name__ == '__main__': |
| 29 | main() |