Ejemplo n.º 1
0
static void run_test(void)
{
	int i;

	for (i = 0; i < iteration; i++) {

		root_printf("[*Round %d Test Running*]\n", i);

		if (test_flags & BASC_TEST)
			basic_test();

		if (test_flags & RAND_TEST)
			basic_test();

		if (test_flags & MMAP_TEST)
			basic_test();

		if (test_flags & ODCT_TEST)
			directio_test();

		if (test_flags & XATR_TEST)
			xattr_test();

		if (test_flags & STRS_TEST)
			stress_test();

		if (test_flags & DEST_TEST)
			dest_test();

		if (test_flags & COMP_TEST)
			comp_test();
	}
}
Ejemplo n.º 2
0
static int test_klog(void) {
  kprintf("Testing klog.\n");
  int mask_old = klog.mask;
  klog.mask = KL_MASK(KL_LOG);

  /* Deleting logs if there are some old left. */
  klog_clear();
  klog_dump();

  /* Testing logging with different number of messages. */
  assert(test_log_messages(1) == 0);
  assert(test_log_messages(KL_SIZE - 1) == 0);
  assert(test_log_messages(KL_SIZE) == 0);
  assert(test_log_messages(KL_SIZE + 1) == 0);
  assert(test_log_messages(3 * KL_SIZE + 1) == 0);
  /* Testing logging messages with multiple threads. */
  assert(multithreads_test(1) == 0);
  assert(multithreads_test(5) == 0);
  assert(multithreads_test(8) == 0);

  assert(logging_with_custom_mask() == 0);
  assert(testing_different_number_of_parametars() == 0);

  assert(stress_test() == 0);
  /* Testing logging while klog don't accept any logs. */
  klog.mask = 0;
  assert(logging_klog_zero_mask() == 0);

  klog.mask = mask_old;

  return KTEST_SUCCESS;
}
Ejemplo n.º 3
0
int
main(int argc, char *argv[])
{

        setbuf(stdout,NULL);
        stress_test(1 << 2);
        struct s_arena *arena = new_arena();
        for(int i = 0;i < 10; i++) {
        struct s_cache *sc = new_cache(arena,i,0);
        print_cache(sc);
        }
        struct s_cache *sc1 = new_cache(arena,7,4);
        struct s_cache *sc2 = new_cache(arena,1,3);

        printf("Alloc1: %p\n", s_alloc(saved_gc, sc1));
        printf("Alloc1: %p\n", s_alloc(saved_gc, sc1));
        printf("Alloc1: %p\n", s_alloc(saved_gc, sc1));
        printf("Alloc2: %p\n", s_alloc(saved_gc, sc2));
        printf("Alloc2: %p\n", s_alloc(saved_gc, sc2));
        printf("Alloc2: %p\n", s_alloc(saved_gc, sc2));

        print_cache(sc1);
        print_cache(sc2);

        return 0;
}
Ejemplo n.º 4
0
void run_ata_tests(){ 
    test_single_rw();
    test_multiple_threads();
    stress_test();
    
    dbg(DBG_TESTPASS, "All ata tests passed!\n");
}
Ejemplo n.º 5
0
void run_tests(int iter)
{
	testno = 1;
	snprintf(dirent_name, OCFS2_MAX_FILENAME_LEN,
                 "multi-indexed-dirs-test-%d", iter);
        snprintf(dir_name, OCFS2_MAX_FILENAME_LEN, "%s/%s", work_place,
                 dirent_name);

	if (test_flags & GROW_TEST)
		grow_test();
	
	if (test_flags & RENM_TEST)
		rw_test();

	if (test_flags & READ_TEST)
		read_test();

	if (test_flags & ULNK_TEST)
		unlink_test();

	if (test_flags & FLUP_TEST)
		fillup_test();

	if (test_flags & STRS_TEST)
		stress_test();
}
Ejemplo n.º 6
0
std::vector<iteration_result> StressIncreaseToMax::execute_test_iterations(
	const TaskConf& task_conf,
	unsigned time,
	size_t requested_memory_limit)
{
		TimerSysTime timer;
		unsigned itr = 0;
		std::vector<iteration_result> results;

		std::ofstream csv_file;

		csv::Row row;
		row.append("Iteration");
		row.append("Allocated memory (MB)");
		row.append("Elapsed time (seconds)");
		if(task_conf.is_csv_log_enabled)
		{
			csv_file.open("stress_test_increase_to_max.csv");
			csv_file << row.export_row();
		}
		printf("%s", row.export_row().c_str());

		timer.start();

		while (timer.getElapsedTime() < time)
		{
			StressIncreaseToMax stress_test(task_conf, requested_memory_limit);
			stress_test.run();
			float elapsed_time = timer.getElapsedTime();

			TimeStats stats;
			stats += stress_test.get_results();

			results.push_back(stress_test.get_test_status());

			//Log every interation of StressIncreaseToMax test.
			csv::Row row;
			row.append(itr);
			row.append(convert_bytes_to_mb(stats.get_allocated()));
			row.append(elapsed_time);
			if(task_conf.is_csv_log_enabled)
			{
				csv_file << row.export_row();
			}
			printf("%s", row.export_row().c_str());
			fflush(stdout);

			itr++;
		}

		printf("\nStress test (StressIncreaseToMax) finish in time %f.\n",timer.getElapsedTime());

		csv_file.close();

		return results;
}
Ejemplo n.º 7
0
int main()
{
	int size;

	mydisk_init("diskfile", MAX_BLOCKS, 0);
	init_cache(CACHED_BLOCKS);
	
	/* Test case 1: read/write block */
	size = BLOCK_SIZE;
	memset(buffer, 0, size);
	strcpy(buffer, "hello world\n");
	mydisk_write_block(0, buffer);
	memset(buffer2, 0, size);
	mydisk_read_block(0, buffer2);
	check_test(memcmp(buffer2, "hello world\n", 13));

	/* Test case 2: basic read/write */
	memset(buffer, 0, size);
	mydisk_read(0, 13, buffer);
	check_test(memcmp(buffer, "hello world\n", 13));

	/* Test case 3: read in the middle */
	memset(buffer, 0, BLOCK_SIZE);
	mydisk_read(8, 5, buffer);
	check_test(memcmp(buffer, "rld\n", 5));

	/* Test case 4: read/write across blocks */
	size = BLOCK_SIZE;
	rand_str(buffer, size);
	mydisk_write(144, size, buffer);
	memset(buffer2, 0, size);
	mydisk_read(144, size, buffer2);
	check_test(memcmp(buffer, buffer2, size));

	/* Test case 5: large read/write */
	size = BLOCK_SIZE * (MAX_BLOCKS - 1);
	rand_str(buffer, size);
	mydisk_write(276, size, buffer);
	mydisk_read(276, size, buffer2);
	check_test(memcmp(buffer, buffer2, size));

	/* Test case 6~9: read/write exception */
	check_test(!mydisk_read(-1, 0, buffer));
	check_test(!mydisk_read(0, -10, buffer));
	check_test(!mydisk_read(100, BLOCK_SIZE * MAX_BLOCKS, buffer));
	check_test(mydisk_write(0, 0, buffer));

	check_test(stress_test());
	check_test(stress_test2());

	close_cache();
	mydisk_close();
	return 0;
}
Ejemplo n.º 8
0
int main(int argc, char *argv[])
{
    printf("** Basic operations **\n");
    test_basic_operations();
    printf("Verified OK!\n\n");

    printf("** Stress test **\n");
    stress_test();
    printf("Verified OK!\n\n");

    return 0;
}
Ejemplo n.º 9
0
void neg_test(void)
{
	struct val_neg_cache* neg;
	srandom(48);
	unit_show_feature("negative cache");

	/* create with defaults */
	neg = val_neg_create(NULL, 1500);
	unit_assert(neg);
	
	stress_test(neg);

	neg_cache_delete(neg);
}
Ejemplo n.º 10
0
int main(int argc, char **argv) {
	if(argc != 2) return 1;
	std::string test(argv[1]);
	if (test == "basic1") {
		exit(basic1()?EXIT_SUCCESS:EXIT_FAILURE);
	} else if (test == "equal_elements") {
		exit(equal_elements()?EXIT_SUCCESS:EXIT_FAILURE);
	} else if (test == "stress_test") {
		stress_test();
		return EXIT_FAILURE;
	}

	std::cerr << "No such test" << std::endl;
	return EXIT_FAILURE;
	
}
Ejemplo n.º 11
0
int
main(int argc, char **argv)
{
	struct mallinfo end_info;

	srand(0);
	basic_test();
	stress_test();
	random_test();
	end_info = mallinfo();

	assert(end_info.uordblks == 0);
	assert(end_info.hblks == 0);

	printf("OK\n");
	return 0;
}
Ejemplo n.º 12
0
int main() {

  stress_test();
  return 0;
  
  int V = 6;
  vvii AdjList(V, vii());
  AdjList[0].push_back(ii(1,5));
  AdjList[1].push_back(ii(2,1));
  AdjList[1].push_back(ii(3,5));
  AdjList[1].push_back(ii(5,3));
  AdjList[2].push_back(ii(4,1));
  AdjList[3].push_back(ii(4,1));
  AdjList[4].push_back(ii(3,2));
  AdjList[5].push_back(ii(4,2));
  vi dist,dist2;
  pq::binary_heap pq(V);
  //pq::fibonacci_heap<ii> pq2;
  dijkstra(pq, AdjList, dist, V, 0);
  //dijkstra(pq2, AdjList, dist2, V, 0);
  std::cout << dist[4] << std::endl;
  //std::cout << dist2[4] << std::endl;
  return 0;
}