执行 AGENTS align-linuxcnc 加速规则
结论:补强 WASM runtime 可执行探针,依据 LinuxCNC src/emc/rs274ngc/rs274ngc_pre.cc 中程序/子程序路径解析对 wordexp() 的使用,覆盖 形式的环境变量展开。验证通过:./test-linuxcnc-wasm-runtime-link.sh、./test-native.sh、./test-linuxcnc-source-link.sh。
This commit is contained in:
@@ -60,6 +60,22 @@ bool wordexp_expands_environment_variables() {
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool wordexp_expands_braced_environment_variables() {
|
||||
setenv("CNC_SIM_WORDEXP_BRACED_PROBE", "linuxcnc-braced-wordexp", 1);
|
||||
|
||||
wordexp_t expanded{};
|
||||
if (wordexp("${CNC_SIM_WORDEXP_BRACED_PROBE}/subroutines", &expanded, 0) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const bool ok = expanded.we_wordc == 1 &&
|
||||
expanded.we_wordv &&
|
||||
expanded.we_wordv[0] &&
|
||||
std::strcmp(expanded.we_wordv[0], "linuxcnc-braced-wordexp/subroutines") == 0;
|
||||
wordfree(&expanded);
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool hal_lookup_is_unavailable() {
|
||||
if (hal_init("cnc_sim_wasm_runtime_probe") != 1) {
|
||||
return false;
|
||||
@@ -109,6 +125,9 @@ int main() {
|
||||
if (!wordexp_expands_environment_variables()) {
|
||||
return 6;
|
||||
}
|
||||
if (!wordexp_expands_braced_environment_variables()) {
|
||||
return 8;
|
||||
}
|
||||
if (!hal_lookup_is_unavailable()) {
|
||||
return 7;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user