Skip to content

Commit 324b9e1

Browse files
committed
test: use native Windows argv probe for queued calls
1 parent 0151322 commit 324b9e1

3 files changed

Lines changed: 4 additions & 5 deletions

File tree

‎openspec/changes/harden-opencli-argv-contract/tasks.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@
3232
- 当前本地回归覆盖完整向量、argv 第三项为 null、空白标识符、等号、引号、反斜杠、`--`、Unicode 和换行。新增排队变更回归。一个真实 JVM 占住共享许可,下一次调用完成列表快照后,调用方修改原列表并释放许可。回显子进程收到提交时的完整向量,调用方原列表只包含它自己所作修改。JDK 17 定向 45 项通过。
3333
- Windows 使用原生 `node.exe` 运行回显夹具,含空白、引号和末尾反斜杠的 token 保留。SDK 会在启动前拒绝 `.cmd`、`.bat` 批处理入口。JDK 17 曾运行真实安装包的启动器测试,仅执行只读元命令。对应 [JDK 8 平台 CI](https://github.com/easy-4-java/opencli-java-sdk/actions/runs/44339054705)、[JDK 17 Windows](https://github.com/easy-4-java/opencli-java-sdk/actions/runs/44339055208/job/134923652889)、[JDK 21 Windows](https://github.com/easy-4-java/opencli-java-sdk/actions/runs/44339054801) 与 [已安装启动器证据](https://github.com/easy-4-java/opencli-java-sdk/actions/runs/44313779366/job/134834399117)。
3434
- 三条维护线使用同一套已校验 SHA-256 的 `argv.tsv`、`ContractProbe` 和 `OpenCliStructuredArgvContractTest`。JDK 17 使用系统 Maven 执行 `-B -ntp -o clean verify`,2,121 项通过,0 失败、0 错误、0 跳过,退出 0。本地报告为 `target/surefire-reports`。三个版本的 JDK/Jackson/Maven 允许差异见 fixture 的 `sources.lock.json`。远端分支最新 CI 单独记录于 PR。
35+
36+
- 排队回归与原始参数回归共用回显启动配置。首次 JDK 17 Windows CI 使用旧 Java 回显启动器时,子进程把原始中文 token 收成 `???`。改用同套 Windows 原生 Node 回显夹具,继续断言完整 Unicode token,并保留 Java 生命周期进程作为许可占用方。[首次 Windows 结果](https://github.com/easy-4-java/opencli-java-sdk/actions/runs/44340768729/job/134929785664)

‎src/test/java/io/github/easy4j/opencli/contract/OpenCliArgvContractTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
/** Shared Java 8-compatible contract tests, with a real child rather than Recording executor. */
3434
class OpenCliArgvContractTest {
35-
private static OpenCliProperties properties() {
35+
static OpenCliProperties properties() {
3636
OpenCliProperties p = new OpenCliProperties();
3737
String exe = System.getProperty("os.name").startsWith("Windows") ? "java.exe" : "java";
3838
p.setExecutable(new File(new File(System.getProperty("java.home"), "bin"), exe).getAbsolutePath());

‎src/test/java/io/github/easy4j/opencli/contract/OpenCliProcessContractTest.java‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,7 @@ void explicitSharedRuntimeLimitsBothClients() throws Exception {
329329
void queuedInvocationUsesItsArgvSnapshotAfterCallerMutation() throws Exception {
330330
OpenCliProcessRuntime runtime = new OpenCliProcessRuntime(1);
331331
OpenCliExecutor blocker = new OpenCliExecutor(properties(1), runtime);
332-
OpenCliProperties echoProperties = properties(1);
333-
List<String> leading = echoProperties.getLeadingArguments();
334-
leading.set(leading.size() - 1, ContractProbe.class.getName());
335-
OpenCliExecutor echo = new OpenCliExecutor(echoProperties, runtime);
332+
OpenCliExecutor echo = new OpenCliExecutor(OpenCliArgvContractTest.properties(), runtime);
336333
List<String> expected = Arrays.asList("demo", "echo", "", " 原始值 ");
337334
CountDownLatch copied = new CountDownLatch(1);
338335
List<String> input = new ArrayList<String>(expected) {

0 commit comments

Comments
 (0)