Libraryless. Click here for Pure Java version (2390L/16K/53K).
!747 m { static new Flag done; static new Flag success; static int myPort, vmPort; static long lastRun; static boolean lastResult; static boolean keepVMAlive = false; // keep VM alive after test (set to false for production!) static S vmProgram = "#1001317"; !include #1000915 // Flag p { myPort = makeAndroid3("Test Case Master Bot.").port; // Start Dependent VM nohupJavax(vmProgram.substring(1) + " " + myPort); sleep(); } static void startTest() { thread { try { DialogIO io = talkTo("localhost", vmPort); print(io.readLine()); io.sendLine("What is your process id?"); S s = io.readLine(); print("VM said: " + s); int pid = parseInt(s); print("PID: " + pid); if (!(pid != 0 && processIDExists("" + pid))) fail(s); io.sendLine("What is the main program id?"); s = io.readLine(); if (parseSnippetID(s) != parseSnippetID(vmProgram)) fail(s); success.raise(); } catch (Throwable e) { e.printStackTrace(); } done.raise(); // so dependent VM exits lastRun = now(); saveLocally("lastRun"); lastResult = success.isUp(); saveLocally("lastResult"); print(success.isUp() ? "TEST SUCCESS" : "TEST FAILURE"); sendTestResult(success.isUp()); } } static synchronized S answer(S s, L<S> history) { new Matches m; if (match3("Master: My VM port is *", s, m)) { if (vmPort == 0) { vmPort = parseInt(unquote(m.m[0])); startTest(); } return "OK"; } if (match3("Master: Should I stay alive?", s)) return !keepVMAlive && done.isUp() ? "No." : "Yes."; return null; } }
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, dhtvkmknsjym, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
ID | Author/Program | Comment | Date | |
---|---|---|---|---|
1164 | #1001318 | Success on teubizvjbppd | 2015-11-02 17:51:49 | delete |
Snippet ID: | #1001318 |
Snippet name: | Test case (start dependent VM and check if it reports its PID and program ID) |
Eternal ID of this version: | #1001318/1 |
Text MD5: | 174912f5260e153918e2a9501c961bbb |
Transpilation MD5: | c7294b8ce67b3038611cc01805d4f573 |
Author: | stefan |
Category: | javax |
Type: | JavaX General Test Case |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-11-02 17:51:08 |
Source code size: | 1888 bytes / 73 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 973 / 1035 |
Referenced in: | [show references] |