Esempio n. 1
0
int main(int argc, char ** argv )
{
    TestContext tc;
    test_init(argc, argv, &tc);
    
    
    // ADD TESTS HERE
    run(&test_blocking_threads,"Conditional wait and signal",&tc);
    run(&test_get_compress_from_body,"Get read buffer",&tc);
    run(&test_update_players_from_compress,"Update players from compress",&tc);
    run(&test_update_objects_from_compress,"Update objects from compress",&tc);
    // TEST END HERE

    test_summary(&tc);
    return 0;    
}
Esempio n. 2
0
int main( void )
{
    libvlc_instance_t *p_vlc;

    test_init();

    log( "Testing the core variables\n" );
    p_vlc = libvlc_new( test_defaults_nargs, test_defaults_args );
    assert( p_vlc != NULL );

    test_variables( p_vlc );

    libvlc_release( p_vlc );

    return 0;
}
Esempio n. 3
0
int main(int argc, char *argv[])
{
    void *fdt;

    test_init(argc, argv);
    fdt = load_blob_arg(argc, argv);

    check_alias(fdt, "/[email protected]", "s1");
    check_alias(fdt, "/[email protected]/subsubnode", "ss1");
    check_alias(fdt, "/[email protected]/subsubnode", "s1/subsubnode");
    check_alias(fdt, "/[email protected]/subsubnode/subsubsubnode", "sss1");
    check_alias(fdt, "/[email protected]/subsubnode/subsubsubnode", "ss1/subsubsubnode");
    check_alias(fdt, "/[email protected]/subsubnode/subsubsubnode", "s1/subsubnode/subsubsubnode");

    PASS();
}
int main(int argc, char** argv)
{
	printf("CYPTO        TESTS\n");
	printf("==================\n\n");

	init(argc, argv);

	test_init();
	test_handle_init();
	test_enc_and_dec_with_string();
	test_enc_and_dec_with_binary();
	test_enc_and_dec_with_null();

	printf("\ntestmod_crypto RESULTS: %d test(s) done. %d error(s).\n", nbTest, nbError);
	return nbError;
}
int
main (int argc,
    char **argv)
{
  int result;

  test_init (argc, argv);

  g_test_add_func ("/irc-server/new", test_empathy_irc_server_new);
  g_test_add_func ("/irc-server/property-change", test_property_change);
  g_test_add_func ("/irc-server/modified-signal", test_modified_signal);

  result = g_test_run ();
  test_deinit ();
  return result;
}
Esempio n. 6
0
int main(int argc, char ** argv)
{
	int exp_len=-1, len=-1;
	char etalon_event_set[EVENT_BUF_LEN];
	char event_set[EVENT_BUF_LEN];

	test_init(argc, argv);

	exp_len = get_event_set(etalon_event_set, 0);
	len = get_event_set(event_set, 1);

	if (check(len, event_set, exp_len, etalon_event_set)) {
		return 1;
	}
	return 0;
}
Esempio n. 7
0
int main(int argc, char **argv)
{
	unsigned long data;
	long delta;
	int fd, fail = NR_FAILS, to_pass = NR_FAILS;
	struct timeval start, end;

	test_init(argc, argv);

	fd = open("/dev/rtc", O_RDWR);
	if (fd < 0) {
		pr_perror("open");
		return 1;
	}

	if (ioctl(fd, RTC_IRQP_SET, TEST_HZ) == -1) {
		pr_perror("RTC_IRQP_SET");
		return 1;
	}

	if (ioctl(fd, RTC_PIE_ON, 0) == -1) {
		pr_perror("RTC_PIE_ON");
		return 1;
	}

	test_daemon();

	gettimeofday(&start, NULL);
	start.tv_usec += start.tv_sec * 1000000;
	while (test_go() || to_pass--) {
		if (read(fd, &data, sizeof(unsigned long)) == -1)
			return 1;
		gettimeofday(&end, NULL);
		end.tv_usec += end.tv_sec * 1000000;
		delta = end.tv_usec - start.tv_usec;
		if (labs(delta - 1000000 / TEST_HZ ) > 100000) {
			pr_perror("delta = %ld", delta);
			fail--;
			if (fail == 0)
				return 1;
		}
		start = end;
	}
	pass();

	return 0;
}
Esempio n. 8
0
int main(int argc, char **argv)
{
	int sk;
	struct tpacket_req3 ring;
	void *mem;

	test_init(argc, argv);

	sk = socket(PF_PACKET, SOCK_RAW, 0);
	if (sk < 0) {
		pr_perror("Can't create socket 1");
		return 1;
	}

	memset(&ring, 0, sizeof(ring));
	ring.tp_block_size = PAGE_SIZE;
	ring.tp_block_nr = 1;
	ring.tp_frame_size = 1024;
	ring.tp_frame_nr = (ring.tp_block_size / ring.tp_frame_size) * ring.tp_block_nr;
	if (setsockopt(sk, SOL_PACKET, PACKET_RX_RING, &ring, sizeof(ring)) < 0) {
		pr_perror("Can't set rx ring");
		return 1;
	}

	memset(&ring, 0, sizeof(ring));
	ring.tp_block_size = PAGE_SIZE;
	ring.tp_block_nr = 1;
	ring.tp_frame_size = 1024;
	ring.tp_frame_nr = (ring.tp_block_size / ring.tp_frame_size) * ring.tp_block_nr;
	if (setsockopt(sk, SOL_PACKET, PACKET_TX_RING, &ring, sizeof(ring)) < 0) {
		pr_perror("Can't set tx ring");
		return 1;
	}

	mem = mmap(NULL, 2 * PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FILE, sk, 0);
	if (mem == MAP_FAILED) {
		pr_perror("Can't mmap socket");
		return 1;
	}

	test_daemon();
	test_waitsig();

	check_map_is_there((unsigned long)mem, sk);

	return 0;
}
Esempio n. 9
0
int main(int argc, char **argv)
{
	void *mem;
	int i, fail = 0;
	unsigned rover = 1;
	unsigned backup[MEM_PAGES] = {};

	srand(time(NULL));

	test_init(argc, argv);

	mem = mmap(NULL, MEM_PAGES * PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, 0, 0);
	if (mem == MAP_FAILED)
		return 1;

	test_msg("mem %p backup %p\n", mem, backup);

	test_daemon();
	while (test_go()) {
		unsigned pfn;
		struct timespec req = { .tv_sec = 0, .tv_nsec = 100000, };

		pfn = random() % MEM_PAGES;
		*(unsigned *)(mem + pfn * PAGE_SIZE) = rover;
		backup[pfn] = rover;
		test_msg("t %u %u\n", pfn, rover);
		rover++;
		nanosleep(&req, NULL);
	}
	test_waitsig();

	test_msg("final rover %u\n", rover);
	for (i = 0; i < MEM_PAGES; i++)
		if (backup[i] != *(unsigned *)(mem + i * PAGE_SIZE)) {
			test_msg("Page %u differs want %u has %u\n", i,
					backup[i], *(unsigned *)(mem + i * PAGE_SIZE));
			fail = 1;
		} else
			test_msg("Page %u matches %u\n", i, backup[i]);

	if (fail)
		fail("Memory corruption\n");
	else
		pass();

	return 0;
}
Esempio n. 10
0
int
test_main (void)
{
    size_t i;

    test_init ();

    printf ("%20s", "");
    FOR_EACH_IMPL (impl, 0)
    printf ("\t%s", impl->name);
    putchar ('\n');

    for (i = 1; i < 8; ++i)
    {
        do_test (0, i, i - 1, 127);
        do_test (0, i, i, 127);
        do_test (0, i, i + 1, 127);
    }

    for (i = 1; i < 8; ++i)
    {
        do_test (i, i, i - 1, 127);
        do_test (i, i, i, 127);
        do_test (i, i, i + 1, 127);
    }

    for (i = 2; i <= 10; ++i)
    {
        do_test (0, 1 << i, 5000, 127);
        do_test (1, 1 << i, 5000, 127);
    }

    for (i = 1; i < 8; ++i)
        do_test (0, i, 5000, 255);

    for (i = 1; i < 8; ++i)
        do_test (i, i, 5000, 255);

    for (i = 2; i <= 10; ++i)
    {
        do_test (0, 1 << i, 5000, 255);
        do_test (1, 1 << i, 5000, 255);
    }

    return ret;
}
Esempio n. 11
0
int
main (int   argc,
      char *argv[])
{
	test_init_gettext ();
	test_init ();
	test_suggest_help ();
	test_version ();
	test_daemonise ();
	test_set_pidfile ();
	test_read_pidfile ();
	test_write_pidfile ();
	test_main_loop ();
	test_main_loop_add_func ();

	return 0;
}
Esempio n. 12
0
int main(int argc, char ** argv)
{
	int pipefd[2];
	pthread_t thr;
	char c;
	void *retcode;

	test_init(argc, argv);

	if (socketpair(AF_FILE, SOCK_SEQPACKET, 0, pipefd)) {
		err("pipe");
		return -1;
	}

	if (pthread_create(&thr, NULL, drop_caps_and_wait, &pipefd[0])) {
		err("Unable to create thread");
		return -1;
	}

	/*
	 * Wait for child to signal us that it has droped caps.
	 */
	if (read(pipefd[1], &c, 1) != 1) {
		err("read");
		return 1;
	}

	test_daemon();
	test_waitsig();

	if (write(pipefd[1], &c, 1) != 1) {
		err("write");
		return 1;
	}

	if (pthread_join(thr, &retcode)) {
		err("Unable to jount a thread");
		return 1;
	}
	if (retcode != NULL)
		return 1;

	pass();

	return 0;
}
int main(int argc, char **argv)
{
	struct test test;
	int i;

	test_init(&test, argc, argv);

	for (i = 0; i <= DEFAULT_ITERATIONS; i++) {
		int reps = REPS(i), sets = SETS(i);
		enum target t;

		for (t = TARGET_FIRST; t <= TARGET_LAST; t++)
			ref_tests(&test, reps, sets, t);
	}

	return 0;
}
Esempio n. 14
0
int
main (int argc, char **argv)
{
	test_init (argc, argv, NULL);

	server = soup_test_server_new (TRUE);
	soup_server_add_handler (server, NULL, server_callback, NULL, NULL);
	base_uri = soup_uri_new ("http://127.0.0.1/");
	soup_uri_set_port (base_uri, soup_server_get_port (server));

	do_coding_test ();

	soup_uri_free (base_uri);

	test_cleanup ();
	return errors != 0;
}
Esempio n. 15
0
int main(int argc, char* argv[])
{
    g_test_init(&argc, &argv, NULL);
    g_test_add_func(TEST_PREFIX "null", test_history_null);
    g_test_add_func(TEST_PREFIX "basic", test_history_basic);
    g_test_add_func(TEST_PREFIX "clear", test_history_clear);
    g_test_add_func(TEST_PREFIX "median", test_history_median);
    g_test_add_func(TEST_PREFIX "size", test_history_size);
    g_test_add_func(TEST_PREFIX "interval", test_history_interval);
    g_test_add_data_func(TEST_PREFIX "data1", &data1, test_history_data);
    g_test_add_data_func(TEST_PREFIX "data2", &data2, test_history_data);
    g_test_add_data_func(TEST_PREFIX "data3", &data3, test_history_data);
    g_test_add_data_func(TEST_PREFIX "data4", &data4, test_history_data);
    g_test_add_data_func(TEST_PREFIX "data5", &data5, test_history_data);
    test_init(&test_opt, argc, argv);
    return g_test_run();
}
Esempio n. 16
0
int main(int argc, char *argv[])
{
	void *fdt;
	int subnode1_offset, subnode2_offset;
	int subsubnode1_offset, subsubnode2_offset, subsubnode2_offset2;

	test_init(argc, argv);
	fdt = load_blob_arg(argc, argv);

	check_path_offset(fdt, "/", 0);

	subnode1_offset = check_subnode(fdt, 0, "[email protected]");
	subnode2_offset = check_subnode(fdt, 0, "[email protected]");

	check_path_offset(fdt, "/[email protected]", subnode1_offset);
	check_path_offset(fdt, "/[email protected]", subnode2_offset);

	subsubnode1_offset = check_subnode(fdt, subnode1_offset, "subsubnode");
	subsubnode2_offset = check_subnode(fdt, subnode2_offset, "[email protected]");
	subsubnode2_offset2 = check_subnode(fdt, subnode2_offset, "subsubnode");

	check_path_offset(fdt, "/[email protected]/subsubnode", subsubnode1_offset);
	check_path_offset(fdt, "/[email protected]/[email protected]", subsubnode2_offset);
	check_path_offset(fdt, "/[email protected]/subsubnode", subsubnode2_offset2);

	/* Test paths with extraneous separators */
	check_path_offset(fdt, "//", 0);
	check_path_offset(fdt, "///", 0);
	check_path_offset(fdt, "//[email protected]", subnode1_offset);
	check_path_offset(fdt, "/[email protected]/", subnode1_offset);
	check_path_offset(fdt, "//[email protected]///", subnode1_offset);
	check_path_offset(fdt, "/[email protected]////subsubnode", subsubnode2_offset2);

	/* Test fdt_path_offset_namelen() */
	check_path_offset_namelen(fdt, "/[email protected]", 1, 0);
	check_path_offset_namelen(fdt, "/[email protected]/subsubnode", 10, subnode1_offset);
	check_path_offset_namelen(fdt, "/[email protected]/subsubnode", 11, subnode1_offset);
	check_path_offset_namelen(fdt, "/[email protected]", 10, subnode2_offset);
	check_path_offset_namelen(fdt, "/[email protected]", 11, -FDT_ERR_NOTFOUND);
	check_path_offset_namelen(fdt, "/[email protected]/[email protected]/more", 23, subsubnode2_offset2);
	check_path_offset_namelen(fdt, "/[email protected]/[email protected]/more", 22, -FDT_ERR_NOTFOUND);
	check_path_offset_namelen(fdt, "/[email protected]/[email protected]/more", 24, subsubnode2_offset2);
	check_path_offset_namelen(fdt, "/[email protected]/[email protected]/more", 25, -FDT_ERR_NOTFOUND);

	PASS();
}
int main(int argc, char **argv)
{
	struct test test;
	int i;

	test_init(&test, argc, argv);

	for (i = 0; i <= DEFAULT_ITERATIONS; i++) {
		int reps = REPS(i), sets = SETS(i);

		pixel_tests(&test, reps, sets, PIXMAP);
		area_tests(&test, reps, sets, PIXMAP);
		rect_tests(&test, reps, sets, PIXMAP, 0);
	}

	return 0;
}
Esempio n. 18
0
int main(int argc, char **argv)
{
	struct test test;
	int t;

	test_init(&test, argc, argv);
	XSetErrorHandler(_check_error_handler);

	for (t = TARGET_FIRST; t <= TARGET_LAST; t++) {
		single(&test, t);
		//overlapping(&test, t);
		//gap(&test, t);
		//mixed(&test, t);
	}

	return 0;
}
Esempio n. 19
0
int main(int argc, char **argv)
{
	char test_dir[PATH_MAX], test_bind[PATH_MAX];
	char test_file[PATH_MAX], test_bind_file[PATH_MAX];
	int fd;

	test_init(argc, argv);

	mkdir(dirname, 0700);

	snprintf(test_dir, sizeof(test_dir), "%s/test", dirname);
	snprintf(test_bind, sizeof(test_bind), "%s/bind", dirname);
	snprintf(test_file, sizeof(test_file), "%s/test/test.file", dirname);
	snprintf(test_bind_file, sizeof(test_bind_file), "%s/bind/test.file", dirname);

	mkdir(test_dir, 0700);
	mkdir(test_bind, 0700);

	if (mount(test_dir, test_bind, NULL, MS_BIND, NULL)) {
		pr_perror("Unable to mount %s to %s", test_dir, test_bind);
		return 1;
	}

	test_daemon();
	test_waitsig();

	fd = open(test_file, O_CREAT | O_WRONLY | O_EXCL, 0600);
	if (fd < 0) {
		pr_perror("Unable to open %s", test_file);
		return 1;
	}
	close(fd);

	if (access(test_bind_file, F_OK)) {
		pr_perror("%s doesn't exist", test_bind_file);
		return 1;
	}

	if (umount(test_bind)) {
		pr_perror("Unable to umount %s", test_bind);
		return 1;
	}

	pass();
	return 0;
}
Esempio n. 20
0
int
main (int argc,
    char **argv)
{
  test_init (&argc, &argv);

  g_test_add ("/refs/connection", Fixture, NULL, setup_connection,
      test_connection, teardown);
  g_test_add ("/refs/message", Fixture, NULL, setup,
      test_message, teardown);
  g_test_add ("/refs/pending-call", Fixture, NULL, setup_connection,
      test_pending_call, teardown);
  g_test_add ("/refs/server", Fixture, NULL, setup,
      test_server, teardown);

  return g_test_run ();
}
Esempio n. 21
0
int main(int argc, char *argv[]) {
	struct xmi_archive *archive = NULL;
	int i,j;

	//init test
	g_assert(test_init() == 1);

	//download file
	g_assert(test_download_file(TEST_XMSA_URL_1) == 1);

	//read the file
	g_assert(xmi_read_archive_xml(TEST_XMSA_1, &archive) == 1);

	//some testing of the input and output
	for (i = 0 ; i <= archive->nsteps1 ; i++) {
		for (j = 0 ; j <= archive->nsteps2 ; j++) {
			struct xmi_output *output_copy = NULL;
			xmi_copy_output(archive->output[i][j], &output_copy);
			g_assert(xmi_validate_input(output_copy->input) == 0);
			g_assert(xmi_compare_input(archive->input[i][j], output_copy->input) == 0);
			xmi_free_output(output_copy);
		}
	}

	xmi_free_archive(archive);

	//download file
	g_assert(test_download_file(TEST_XMSA_URL_2) == 1);

	//read the file
	g_assert(xmi_read_archive_xml(TEST_XMSA_2, &archive) == 1);

	//some testing of the input and output
	for (i = 0 ; i <= archive->nsteps1 ; i++) {
		for (j = 0 ; j <= archive->nsteps2 ; j++) {
			struct xmi_output *output_copy = NULL;
			xmi_copy_output(archive->output[i][j], &output_copy);
			g_assert(xmi_validate_input(output_copy->input) == 0);
			g_assert(xmi_compare_input(archive->input[i][j], output_copy->input) == 0);
			xmi_free_output(output_copy);
		}
	}

	xmi_free_archive(archive);
	return 0;
}
Esempio n. 22
0
int main(int argc, char *argv[])
{
	void *fdt;

	test_init(argc, argv);
	fdt = load_blob_arg(argc, argv);

	check_compatible(fdt, "/", "test_tree1");
	check_compatible(fdt, "/[email protected]/subsubnode", "subsubnode1");
	check_compatible(fdt, "/[email protected]/subsubnode", "subsubnode");
	check_not_compatible(fdt, "/[email protected]/subsubnode", "subsubnode2");
	check_compatible(fdt, "/[email protected]/subsubnode", "subsubnode2");
	check_compatible(fdt, "/[email protected]/subsubnode", "subsubnode");
	check_not_compatible(fdt, "/[email protected]/subsubnode", "subsubnode1");

	PASS();
}
Esempio n. 23
0
int main(int argc, char ** argv)
{
	int p[2], fd;
	int ret;
	char path[PATH_MAX];
	int flags;

	test_init(argc, argv);

	ret = pipe(p);
	if (ret)
		return 1;

	snprintf(path, sizeof(path), "/proc/self/fd/%d", p[0]);

	fd = open(path, O_RDONLY);
	if (fd == -1) {
		err("open");
		return 1;
	};

	if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK) == -1) {
		err("fcntl");
		return 1;
	}

	test_daemon();

	test_waitsig();

	flags = fcntl(fd, F_GETFL, 0);
	if ((flags & O_NONBLOCK) == 0) {
		fail("O_NONBLOCK are not restored for %d", fd);
		return 1;
	}

	flags = fcntl(p[0], F_GETFL, 0);
	if ((flags & O_NONBLOCK) != 0) {
		fail("Unexpected O_NONBLOCK on %d", p[0]);
		return 1;
	}

	pass();

	return 0;
}
Esempio n. 24
0
int
test_main (void)
{
    size_t i;

    test_init ();

    printf ("%23s", "");
    FOR_EACH_IMPL (impl, 0)
    printf ("\t%s", impl->name);
    putchar ('\n');

    for (i = 1; i < 16; ++i)
    {
        do_test (i * CHARBYTES, i * CHARBYTES, i, 0);
        do_test (i * CHARBYTES, i * CHARBYTES, i, 1);
        do_test (i * CHARBYTES, i * CHARBYTES, i, -1);
    }

    for (i = 0; i < 16; ++i)
    {
        do_test (0, 0, i, 0);
        do_test (0, 0, i, 1);
        do_test (0, 0, i, -1);
    }

    for (i = 1; i < 10; ++i)
    {
        do_test (0, 0, 2 << i, 0);
        do_test (0, 0, 2 << i, 1);
        do_test (0, 0, 2 << i, -1);
        do_test (0, 0, 16 << i, 0);
        do_test ((8 - i) * CHARBYTES, (2 * i) * CHARBYTES, 16 << i, 0);
        do_test (0, 0, 16 << i, 1);
        do_test (0, 0, 16 << i, -1);
    }

    for (i = 1; i < 8; ++i)
    {
        do_test (i * CHARBYTES, 2 * (i * CHARBYTES), 8 << i, 0);
        do_test (i * CHARBYTES, 2 * (i * CHARBYTES), 8 << i, 1);
        do_test (i * CHARBYTES, 2 * (i * CHARBYTES), 8 << i, -1);
    }

    return ret;
}
Esempio n. 25
0
static void test_tco1_control_bits(void)
{
    TestData d;
    uint16_t val;

    d.args = NULL;
    d.noreboot = true;
    test_init(&d);

    val = TCO_LOCK;
    qpci_io_writew(d.dev, d.tco_io_bar, TCO1_CNT, val);
    val &= ~TCO_LOCK;
    qpci_io_writew(d.dev, d.tco_io_bar, TCO1_CNT, val);
    g_assert_cmpint(qpci_io_readw(d.dev, d.tco_io_bar, TCO1_CNT), ==,
                    TCO_LOCK);
    test_end(&d);
}
Esempio n. 26
0
int main(int argc, char **argv)
{
	struct test test;
	enum target target;
	enum mask mask;
	enum edge edge;

	test_init(&test, argc, argv);

	for (target = TARGET_FIRST; target <= TARGET_LAST; target++) {
		for (mask = MASK_NONE; mask <= MASK_A8; mask++)
			for (edge = EDGE_SHARP; edge <= EDGE_SMOOTH; edge++)
				edge_test(&test, mask, edge, target);
	}

	return 0;
}
Esempio n. 27
0
int
main( void )
{
    struct reader *pp_readers[3];

    test_init();

#ifndef TEST_NET
    char psz_tmp_path[] = "/tmp/libvlc_XXXXXX";
    char *psz_url;
    int i_tmp_fd;

    log( "Test random file with libc, and stream\n" );
    i_tmp_fd = vlc_mkstemp( psz_tmp_path );
    fill_rand( i_tmp_fd, RAND_FILE_SIZE );
    assert( i_tmp_fd != -1 );
    assert( asprintf( &psz_url, "file://%s", psz_tmp_path ) != -1 );

    assert( ( pp_readers[0] = libc_open( psz_tmp_path ) ) );
    assert( ( pp_readers[1] = stream_open( psz_url ) ) );

    test( pp_readers, 2, NULL );
    for( unsigned int i = 0; i < 2; ++i )
        pp_readers[i]->pf_close( pp_readers[i] );
    free( psz_url );

    close( i_tmp_fd );
#else

    log( "Test http url with stream\n" );
    alarm( 0 );
    if( !( pp_readers[0] = stream_open( HTTP_URL ) ) )
    {
        log( "WARNING: can't test http url" );
        return 0;
    }

    test( pp_readers, 1, HTTP_MD5 );
    for( unsigned int i = 0; i < 1; ++i )
        pp_readers[i]->pf_close( pp_readers[i] );

#endif

    return 0;
}
Esempio n. 28
0
int main(int argc, char **argv) {
  CU_pSuite suite;
  int ret, failed_num;
  pid_t pid;

  signal(SIGPIPE, SIG_IGN);

  // preprocessing of tests
  test_init();

  pid = start_newtd();
  if(pid > 0) {
    CU_initialize_registry();

    ADD_TESTS(test_optparse);
    ADD_TESTS(test_config);
    ADD_TESTS(test_signal);
    ADD_TESTS(test_daemon);
    ADD_TESTS(test_frame);
    ADD_TESTS(test_stomp);
    ADD_TESTS(test_queue);
    ADD_TESTS(test_transaction);
    ADD_TESTS(test_persistent);
    ADD_TESTS(test_proto_connect);
    ADD_TESTS(test_proto_disconnect);
    ADD_TESTS(test_proto_subscribe);
    ADD_TESTS(test_proto_reply_to);
    ADD_TESTS(test_proto_topic);
    ADD_TESTS(test_proto_begin);
    ADD_TESTS(test_proto_error);
    ADD_TESTS(test_newtctl_worker);

    CU_basic_run_tests();

    failed_num = CU_get_number_of_tests_failed();

    CU_cleanup_registry();


    kill(pid, SIGINT);
    wait(NULL);
  }

  return failed_num;
}
Esempio n. 29
0
int main(int argc, char ** argv)
{
	int pid[NRTASKS], i, parm[NRTASKS], ret;

	test_init(argc, argv);

	parm[0] = -20;
	parm[1] = 19;
	parm[2] = 1;

	for (i = 0; i < NRTASKS; i++) {
		pid[i] = fork();
		if (!pid[i])
			return do_nothing();

		if (setpriority(PRIO_PROCESS, pid[i], parm[i])) {
			pr_perror("Can't set prio %d", i);
			kill_all(pid, i);
			return -1;
		}
	}

	test_daemon();
	test_waitsig();

	for (i = 0; i < NRTASKS; i++) {
		errno = 0;
		ret = getpriority(PRIO_PROCESS, pid[i]);
		if (errno) {
			fail("No prio for task %d", i);
			break;
		}

		if (ret != parm[i]) {
			fail("Broken nice for %d", i);
			break;
		}
	}

	if (i == NRTASKS)
		pass();

	kill_all(pid, NRTASKS);
	return 0;
}
Esempio n. 30
0
int main(int argc, char ** argv)
{
	int fd;
	char buf[1000000];
	off64_t offset= 0x80002000ULL;
	size_t count;

	test_init(argc, argv);

	fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_LARGEFILE, 0644);
	if (fd < 0) {
		pr_perror("can't open %s", filename);
		exit(1);
	}

	if (lseek64(fd, offset, SEEK_SET) < 0) {
		pr_perror("can't lseek %s, offset= %x", filename,
			offset);
		goto failed;
	}

	count = sizeof(buf);
	memset(buf, 0, count);
	if (write(fd, buf, count) != count) {
		pr_perror("can't write %s", filename);
		goto failed;
	}

	if (unlink(filename) < 0) {
		pr_perror("can't unlink %s", filename);
		goto failed;
	}

	test_daemon();
	test_waitsig();

	close(fd);

	pass();
	return 0;
failed:
	unlink(filename);
	close(fd);
	return 1;
}