Scénario de test & Cas d'usage
Execution of SAS FCMP functions within the CAS environment.
Discover all actions of fcmpactThis test does not require a data step. It focuses on the file generation capability of the action. We will define a prototype for a potentially unstable function, `run_legacy_simulation`, and instruct the action to generate the C bridge file on the CAS server's file system.
| 1 | /* No |
| 2 | data step required. The test validates file generation on the CAS controller. */ |
| 1 | PROC CAS; |
| 2 | fcmpact.addPrototypes |
| 3 | routineCode={"proto run_legacy_simulation(int, double) returns int;"}, |
| 4 | package="LegacySim", |
| 5 | bridgeFile="/cas/data/legacy_sim_bridge.c", |
| 6 | bridgeCatchSignals=true, |
| 7 | funcTable={name="sim_protos", caslib="casuser", replace=true}; |
| 8 | RUN; |
| 9 | QUIT; |
| 1 | /* Conceptual Step: This would test error handling if we could make the path read-only. */ |
| 2 | PROC CAS; |
| 3 | fcmpact.addPrototypes |
| 4 | routineCode={"proto another_func() returns int;"}, |
| 5 | package="LegacySim", |
| 6 | bridgeFile="/read_only_path/another_bridge.c", |
| 7 | funcTable={name="sim_protos_fail", caslib="casuser", replace=true} STATUS=rc; |
| 8 | RUN; |
| 9 | PRINT rc; |
| 10 | QUIT; |
Step 1 should successfully create the `sim_protos` table and, more importantly, generate a C source file named `legacy_sim_bridge.c` at the specified server path `/cas/data/`. The log should confirm the file creation. The generated C code within that file should contain signal handling logic (e.g., for SIGSEGV) because `bridgeCatchSignals` was true. Step 2 is expected to fail, with the `status` parameter `rc` containing a non-zero error code and the log detailing a file system or permission error, proving the action's error handling robustness.