Add labs: 59 Python lab scripts + tools + run_lab.sh
- labs/src/: 59 lab scripts covering OA API (Ch2-Ch25 + extras) - All C++ references removed, oapy-only documentation - labs/tools/: debug and test utilities - labs/run_lab.sh: lab runner with LD_PRELOAD and env setup
This commit is contained in:
20
labs/tools/_debug_path.py
Normal file
20
labs/tools/_debug_path.py
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys, os
|
||||
__dir__ = os.path.dirname(os.path.abspath(__file__))
|
||||
sys.path.insert(0, os.path.join(__dir__, '..', 'build'))
|
||||
sys.path.insert(0, __dir__)
|
||||
print(f'cwd: {os.getcwd()}')
|
||||
print(f'__dir__: {__dir__}')
|
||||
print(f'abs path: {os.path.join(__dir__, "lab13_1_dir")}')
|
||||
from utils import init_oa, create_lib, make_oa_name, make_oa_string, get_namespace
|
||||
init_oa()
|
||||
ns = get_namespace('native')
|
||||
dirname = os.path.join(__dir__, "lab13_1_dir")
|
||||
print(f'Creating at: {dirname}')
|
||||
import shutil
|
||||
if os.path.exists(dirname):
|
||||
shutil.rmtree(dirname)
|
||||
sn_lib, lib = create_lib("lab13_1_lib", dirname)
|
||||
print(f'OK')
|
||||
lib.close()
|
||||
shutil.rmtree(dirname)
|
||||
29
labs/tools/test_dmturbo.py
Normal file
29
labs/tools/test_dmturbo.py
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Minimal test for oaDMTurbo plugin loading"""
|
||||
import sys
|
||||
sys.path.insert(0, '/workarea/ai/openclaw/oapy/build')
|
||||
sys.path.insert(0, '/workarea/ai/openclaw/oapy')
|
||||
|
||||
from oapy._oa import _base, _dm
|
||||
|
||||
print("Initializing OA...")
|
||||
_base.oaInit()
|
||||
|
||||
print("Creating namespace...")
|
||||
ns = _base.oaNativeNS()
|
||||
|
||||
print("Creating lib name...")
|
||||
sn_lib = _base.oaScalarName(ns, "test_dmturbo")
|
||||
|
||||
print("Creating lib with oaDMTurbo...")
|
||||
try:
|
||||
lib = _dm.oaLib.create(
|
||||
sn_lib,
|
||||
_base.oaString("/tmp/test_dmturbo_lib"),
|
||||
_dm.oaLibMode(_dm.oaLibModeEnum.oacSharedLibMode),
|
||||
_base.oaString("oaDMTurbo"),
|
||||
_dm.oaDMAttrArray(0)
|
||||
)
|
||||
print("SUCCESS: Library created")
|
||||
except Exception as e:
|
||||
print(f"FAILED: {e}")
|
||||
Reference in New Issue
Block a user