* Smoke test. This has no time limit, just restart process * when it dies. */
| 250 | * when it dies. |
| 251 | */ |
| 252 | static int test_smoke (void) { |
| 253 | cs_error_t error; |
| 254 | unsigned int instance_id; |
| 255 | struct rlimit lim; |
| 256 | |
| 257 | lim.rlim_cur = lim.rlim_max = 0; |
| 258 | |
| 259 | /* |
| 260 | * Try to turn off core creation |
| 261 | */ |
| 262 | setrlimit(RLIMIT_CORE, &lim); |
| 263 | |
| 264 | printf ("%s: initialize\n", __FUNCTION__); |
| 265 | error = sam_initialize (0, SAM_RECOVERY_POLICY_RESTART); |
| 266 | if (error != CS_OK) { |
| 267 | fprintf (stderr, "Can't initialize SAM API. Error %d\n", error); |
| 268 | return 1; |
| 269 | } |
| 270 | printf ("%s: register\n", __FUNCTION__); |
| 271 | error = sam_register (&instance_id); |
| 272 | if (error != CS_OK) { |
| 273 | fprintf (stderr, "Can't register. Error %d\n", error); |
| 274 | return 1; |
| 275 | } |
| 276 | |
| 277 | if (instance_id < 100) { |
| 278 | printf ("%s iid %d: start\n", __FUNCTION__, instance_id); |
| 279 | error = sam_start (); |
| 280 | if (error != CS_OK) { |
| 281 | fprintf (stderr, "Can't start hc. Error %d\n", error); |
| 282 | return 1; |
| 283 | } |
| 284 | |
| 285 | printf ("%s iid %d: Sending signal\n", __FUNCTION__, instance_id); |
| 286 | kill(getpid(), SIGSEGV); |
| 287 | return 1; |
| 288 | } |
| 289 | |
| 290 | return 0; |
| 291 | |
| 292 | } |
| 293 | |
| 294 | /* |
| 295 | * Test sam_data_store, sam_data_restore and sam_data_getsize |
nothing calls this directly
no test coverage detected