void test_egz_stress() { // create pier files _sist_home(u2A); // delete, recreate egz files u2_egz_rm(); u2_egz_write_header(u2_Host.arv_u, 0); // set a callback after each consolidator run to gather stats // then start consolidator u2_egz_set_consolidator_cb(_test_egz_stress_cb); u2_egz_init(); // set balls in motion // util_run_inside_loop( & _test_egz_stress_w , NULL ); util_run_after_timer( & _test_egz_stress_w , NULL, 0, 0 ); // util_run_after_timer( & util_gate_read , NULL, , 0 ); write_done = 1; util_run_after_timer( & _test_egz_stress_r , NULL, 180, 5 ); util_loop_run(); uL(fprintf(uH, "test done.\n")); }
void test_egz_queue_setup() { _sist_home(u2A); u2_Host.arv_u->key = 1; util_run_inside_loop( & _test_egz_queue, NULL ); util_run_after_timer( & util_loop_stop, NULL, 4, 0); util_loop_run(); }
void test_egz_ova_setup() { _sist_home(u2A); u2_Host.arv_u->key = 1; u2_egz_rm(); u2_egz_init(); // setup_loop(); util_run_inside_loop( & _test_egz_ovo_w , NULL ); util_run_after_timer( & _test_egz_ovo_r , NULL, READ_INTERVAL_SECONDS, READ_INTERVAL_SECONDS ); util_run_after_timer( & util_gate_read , NULL, 20, 1 ); util_run_after_timer( & util_loop_stop , NULL, 30, 0); util_loop_run(); }
/* _sist_zest(): create a new, empty record. */ static void _sist_zest() { struct stat buf_b; c3_i fid_i; c3_c ful_c[8193]; c3_l sal_l; // Create the ship directory. // _sist_home(); // Create the record file. { c3_i pig_i = O_CREAT | O_WRONLY | O_EXCL; #ifdef O_DSYNC pig_i |= O_DSYNC; #endif snprintf(ful_c, 2048, "%s/.urb/egz.hope", u3_Host.dir_c); if ( ((fid_i = open(ful_c, pig_i, 0600)) < 0) || (fstat(fid_i, &buf_b) < 0) ) { uL(fprintf(uH, "can't create record (%s)\n", ful_c)); u3_lo_bail(); } #ifdef F_NOCACHE if ( -1 == fcntl(fid_i, F_NOCACHE, 1) ) { uL(fprintf(uH, "zest: can't uncache %s: %s\n", ful_c, strerror(errno))); u3_lo_bail(); } #endif u3Z->lug_u.fid_i = fid_i; } // Generate a 31-bit salt. // { c3_w rad_w[8]; c3_rand(rad_w); sal_l = (0x7fffffff & rad_w[0]); } // Create and save a passcode. // { c3_w rad_w[8]; u3_noun pas; c3_rand(rad_w); pas = u3i_words(2, rad_w); u3A->key = _sist_fatt(sal_l, u3k(pas)); _sist_fast(pas, u3r_mug(u3A->key)); } // Write the header. { u3_uled led_u; led_u.mag_l = u3r_mug('g'); led_u.kno_w = 163; if ( 0 == u3A->key ) { led_u.key_l = 0; } else { led_u.key_l = u3r_mug(u3A->key); c3_assert(!(led_u.key_l >> 31)); } led_u.sal_l = sal_l; led_u.sev_l = u3A->sev_l; led_u.tno_l = 1; if ( sizeof(led_u) != write(fid_i, &led_u, sizeof(led_u)) ) { uL(fprintf(uH, "can't write record (%s)\n", ful_c)); u3_lo_bail(); } u3Z->lug_u.len_d = c3_wiseof(led_u); } // Work through the boot events. u3_raft_work(); }