test/www: bo duong dan tuyet doi cua may dev
Ba test nay doc app.js/app3d.js qua duong dan cung /home/quangtrung/projects/vslam_cpp/..., nen chi chay duoc tren dung mot may. Tren Jetson chung fail voi ENOENT truoc khi chay duoc dong assert nao -- ctest bao fail nhung khong phai vi logic sai. Dung path.resolve(__dirname, ...) nhu test_scan_frame.js va test_world_mesh.js trong cung thu muc da lam. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -85,7 +85,7 @@ const sandbox = {
|
|||||||
vm.createContext(sandbox);
|
vm.createContext(sandbox);
|
||||||
vm.runInContext(
|
vm.runInContext(
|
||||||
fs.readFileSync(path.resolve(
|
fs.readFileSync(path.resolve(
|
||||||
'/home/quangtrung/projects/vslam_cpp/libs/vslam_web/www/app3d.js'), 'utf8') +
|
__dirname, '../../libs/vslam_web/www/app3d.js'), 'utf8') +
|
||||||
'\n;this.__V3D = V3D; this.__bind = v3dBindMouse; this.__setView = v3dSetView;',
|
'\n;this.__V3D = V3D; this.__bind = v3dBindMouse; this.__setView = v3dSetView;',
|
||||||
sandbox);
|
sandbox);
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ global.THREE = {
|
|||||||
Color: class { constructor() { this.set = () => {}; } },
|
Color: class { constructor() { this.set = () => {}; } },
|
||||||
};
|
};
|
||||||
|
|
||||||
const www = '/home/quangtrung/projects/vslam_cpp/libs/vslam_web/www';
|
const www = path.resolve(__dirname, '../../libs/vslam_web/www');
|
||||||
const sb = { THREE: global.THREE, console, window: {}, document: {} };
|
const sb = { THREE: global.THREE, console, window: {}, document: {} };
|
||||||
vm.createContext(sb);
|
vm.createContext(sb);
|
||||||
vm.runInContext(fs.readFileSync(path.join(www, 'app3d.js'), 'utf8') +
|
vm.runInContext(fs.readFileSync(path.join(www, 'app3d.js'), 'utf8') +
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ for (const k of ['v3dInit', 'v3dSetShape', 'v3dSetPose', 'v3dSetScan', 'v3dSetCl
|
|||||||
}
|
}
|
||||||
vm.createContext(sandbox);
|
vm.createContext(sandbox);
|
||||||
const src = fs.readFileSync(
|
const src = fs.readFileSync(
|
||||||
path.resolve('/home/quangtrung/projects/vslam_cpp/libs/vslam_web/www/app.js'), 'utf8');
|
path.resolve(__dirname, '../../libs/vslam_web/www/app.js'), 'utf8');
|
||||||
vm.runInContext(src + '\n;this.__view = view; this.__sx = sx; this.__sy = sy;' +
|
vm.runInContext(src + '\n;this.__view = view; this.__sx = sx; this.__sy = sy;' +
|
||||||
'\n;this.__ver = UI_VERSION; this.__setCv = (c) => { curCv = c; };' +
|
'\n;this.__ver = UI_VERSION; this.__setCv = (c) => { curCv = c; };' +
|
||||||
'\n;this.__pal = PALETTE; this.__state = state;' +
|
'\n;this.__pal = PALETTE; this.__state = state;' +
|
||||||
|
|||||||
Reference in New Issue
Block a user