Пример #1
0
void test_refs_revparse__head(void)
{
	test_object("HEAD", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
	test_object("HEAD^0", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
	test_object("HEAD~0", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
	test_object("master", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
}
Пример #2
0
void test_refs_revparse__chaining(void)
{
	test_object("master~1^1", "9fd738e8f7967c078dceed8190330fc8648ee56a");
	test_object("master~1^2", "c47800c7266a2be04c571c04d5a6614691ea99bd");
	test_object("master^1^2~1", "5b5b025afb0b4c913b4c338a42934a3863bf3644");
	test_object("master^1^1^1^1^1", "8496071c1b46c854b31185ea97743be6a8774479");
}
Пример #3
0
void test_refs_revparse__to_type(void)
{
	test_object("wrapped_tag^{commit}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
	test_object("wrapped_tag^{tree}", "944c0f6e4dfa41595e6eb3ceecdb14f50fe18162");
	test_object("point_to_blob^{blob}", "1385f264afb75a56a5bec74243be9b367ba4ca08");

	cl_git_fail(git_revparse_single(&g_obj, g_repo, "wrapped_tag^{blob}"));
}
Пример #4
0
void test_refs_revparse__linear_history(void)
{
	cl_git_fail(git_revparse_single(&g_obj, g_repo, "foo~bar"));
	cl_git_fail(git_revparse_single(&g_obj, g_repo, "master~bar"));

	test_object("master~0", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
	test_object("master~1", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
	test_object("master~2", "9fd738e8f7967c078dceed8190330fc8648ee56a");
	test_object("master~1~1", "9fd738e8f7967c078dceed8190330fc8648ee56a");
}
Пример #5
0
void test_refs_revparse__previous_head(void)
{
	assert_invalid_spec("@{-xyz}");
	assert_invalid_spec("@{-0}");
	assert_invalid_spec("@{-1b}");

	test_object("@{-42}", NULL);

	test_object("@{-2}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
	test_object("@{-1}", "a4a7dce85cf63874e984719f4fdd239f5145052f");
}
Пример #6
0
void test_refs_revparse__revwalk(void)
{
	cl_git_fail(git_revparse_single(&g_obj, g_repo, "master^{/not found in any commit}"));
	cl_git_fail(git_revparse_single(&g_obj, g_repo, "master^{/merge}"));
	cl_git_fail(git_revparse_single(&g_obj, g_repo, "master^{/((}"));

	test_object("master^{/anoth}", "5b5b025afb0b4c913b4c338a42934a3863bf3644");
	test_object("master^{/Merge}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
	test_object("br2^{/Merge}", "a4a7dce85cf63874e984719f4fdd239f5145052f");
	test_object("master^{/fo.rth}", "9fd738e8f7967c078dceed8190330fc8648ee56a");
}
Пример #7
0
void test_refs_revparse__to_type(void)
{
	assert_invalid_spec("wrapped_tag^{trip}");
	test_object("point_to_blob^{commit}", NULL);
	cl_assert_equal_i(
		GIT_EAMBIGUOUS, git_revparse_single(&g_obj, g_repo, "wrapped_tag^{blob}"));

	test_object("wrapped_tag^{commit}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
	test_object("wrapped_tag^{tree}", "944c0f6e4dfa41595e6eb3ceecdb14f50fe18162");
	test_object("point_to_blob^{blob}", "1385f264afb75a56a5bec74243be9b367ba4ca08");
	test_object("master^{commit}^{commit}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
}
Пример #8
0
void test_refs_revparse__disambiguation(void)
{
	/*
	 * $ git show e90810b
	 * tag e90810b
	 * Tagger: Vicent Marti <*****@*****.**>
	 * Date:   Thu Aug 12 03:59:17 2010 +0200
	 *
	 * This is a very simple tag.
	 *
	 * commit e90810b8df3e80c413d903f631643c716887138d
	 * Author: Vicent Marti <*****@*****.**>
	 * Date:   Thu Aug 5 18:42:20 2010 +0200
	 *
	 *     Test commit 2
	 *
	 * diff --git a/readme.txt b/readme.txt
	 * index 6336846..0266163 100644
	 * --- a/readme.txt
	 * +++ b/readme.txt
	 * @@ -1 +1,2 @@
	 *  Testing a readme.txt
	 * +Now we add a single line here
	 *
	 * $ git show-ref e90810b
	 * 7b4384978d2493e851f9cca7858815fac9b10980 refs/tags/e90810b
	 *
	 */
	test_object("e90810b", "7b4384978d2493e851f9cca7858815fac9b10980");

	/*
	 * $ git show e90810
	 * commit e90810b8df3e80c413d903f631643c716887138d
	 * Author: Vicent Marti <*****@*****.**>
	 * Date:   Thu Aug 5 18:42:20 2010 +0200
	 *
	 *     Test commit 2
	 *
	 * diff --git a/readme.txt b/readme.txt
	 * index 6336846..0266163 100644
	 * --- a/readme.txt
	 * +++ b/readme.txt
	 * @@ -1 +1,2 @@
	 *  Testing a readme.txt
	 * +Now we add a single line here
	 */
	test_object("e90810", "e90810b8df3e80c413d903f631643c716887138d");
}
static void
empty_activation_cb (CORBA_Object   obj,
                     const char    *error_reason, 
                     gpointer       user_data)
{
        CORBA_Environment ev;
	gboolean          ret = FALSE;
	char             *repo_id = user_data;

        CORBA_exception_init (&ev);

        if (error_reason)
                g_warning ("Async activation error activating '%s' : '%s'", repo_id, error_reason);

        else if (test_object (obj, &ev, "by async query"))
                ret = test_empty (obj, &ev, "by async query");

	if (ret) {
		passed++;
		fprintf (stderr, "PASSED %d of %d: async activation\n", passed + failed, TOTAL_TEST_SCORE);
	} else {
		failed++;
		fprintf (stderr, "FAILED %d of %d: async activation\n", passed + failed, TOTAL_TEST_SCORE);
	}

        CORBA_exception_free (&ev);

        async_done++;
}
Пример #10
0
int main(void)
{
    JsonNode *node;

    (void) chomp;

    plan_tests(49);

    ok1(json_find_element(NULL, 0) == NULL);
    ok1(json_find_member(NULL, "") == NULL);
    ok1(json_first_child(NULL) == NULL);

    node = json_mknull();
    should_be(node, "null");
    json_delete(node);

    node = json_mkbool(false);
    should_be(node, "false");
    json_delete(node);

    node = json_mkbool(true);
    should_be(node, "true");
    json_delete(node);

    test_string();
    test_number();
    test_array();
    test_object();

    return exit_status();
}
Пример #11
0
int main()
{
	std::array<std::string, 5> arr = { "a","b","c", "d", "e" };
	test_array(arr);

	std::vector<std::string> vt = { "a","b","c", "d", "e" };
	test_array(vt);

	int int_arr[5] = { 1,2,3,4,5 };
	test_array(int_arr);

	std::string str_arr[5] = { "a","b","c", "d", "e" };
	test_array(str_arr);

	std::queue<std::string> que_arr;
	que_arr.emplace("a");
	que_arr.emplace("b");
	test_array(que_arr);

	std::deque<std::string> deque_arr;
	deque_arr.push_back("a");
	deque_arr.push_back("b");
	test_array(deque_arr);

	std::priority_queue<std::string> priodeque_arr;
	priodeque_arr.push("a");
	priodeque_arr.push("b");
	test_array(priodeque_arr);

	std::set<std::string> set_arr;
	set_arr.emplace("a");
	set_arr.emplace("b");
	test_array(set_arr);
	std::multiset<std::string> multiset_arr;
	multiset_arr.emplace("a");
	multiset_arr.emplace("b");
	test_array(multiset_arr);
	std::unordered_set<std::string> unordset_arr;
	unordset_arr.emplace("a");
	unordset_arr.emplace("b");
	test_array(unordset_arr);

	std::stack<std::string> stack_arr;
	stack_arr.emplace("a");
	stack_arr.emplace("b");
	test_array(stack_arr);

	std::map<int, std::string> map = { {1, "a"},{2, "b"} };
	test_map(map);
	std::multimap<int, std::string> multimap = { { 1, "a" },{ 2, "b" } };
	test_map(multimap);
	std::unordered_map<int, std::string> unodermap = { { 1, "a" },{ 2, "b" } };
	test_map(unodermap);

	person p = { 20, "test" };
	test_object(p);

	return 0;
}
Пример #12
0
void test_refs_revparse__chaining(void)
{
	assert_invalid_spec("master@{0}@{0}");
	assert_invalid_spec("@{u}@{-1}");
	assert_invalid_spec("@{-1}@{-1}");
	assert_invalid_spec("@{-3}@{0}");

	test_object("master@{0}~1^1", "9fd738e8f7967c078dceed8190330fc8648ee56a");
	test_object("@{u}@{0}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
	test_object("@{-1}@{0}", "a4a7dce85cf63874e984719f4fdd239f5145052f");
	test_object("@{-4}@{1}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
	test_object("master~1^1", "9fd738e8f7967c078dceed8190330fc8648ee56a");
	test_object("master~1^2", "c47800c7266a2be04c571c04d5a6614691ea99bd");
	test_object("master^1^2~1", "5b5b025afb0b4c913b4c338a42934a3863bf3644");
	test_object("master^^2^", "5b5b025afb0b4c913b4c338a42934a3863bf3644");
	test_object("master^1^1^1^1^1", "8496071c1b46c854b31185ea97743be6a8774479");
	test_object("master^^1^2^1", NULL);
}
Пример #13
0
void test_refs_revparse__ordinal(void)
{
	assert_invalid_spec("master@{-2}");
	
	/* TODO: make the test below actually fail
	 * cl_git_fail(git_revparse_single(&g_obj, g_repo, "master@{1a}"));
	 */

	test_object("nope@{0}", NULL);
	test_object("master@{31415}", NULL);
	test_object("@{1000}", NULL);
	test_object("@{2}", NULL);

	test_object("@{0}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
	test_object("@{1}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");

	test_object("master@{0}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
	test_object("master@{1}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
	test_object("heads/master@{1}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
	test_object("refs/heads/master@{1}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
}
Пример #14
0
int
main (int argc, char **argv)
{
    qof_init();
    if (cashobjects_register())
    {
        test_object();
        print_test_results();
    }
    qof_close();
    return get_rv();
}
Пример #15
0
void test_refs_revparse__not_tag(void)
{
	test_object("point_to_blob^{}", "1385f264afb75a56a5bec74243be9b367ba4ca08");
	test_object("wrapped_tag^{}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
	test_object("master^{}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
	test_object("master^{tree}^{}", "944c0f6e4dfa41595e6eb3ceecdb14f50fe18162");
	test_object("e90810b^{}", "e90810b8df3e80c413d903f631643c716887138d");
	test_object("tags/e90810b^{}", "e90810b8df3e80c413d903f631643c716887138d");
	test_object("e908^{}", "e90810b8df3e80c413d903f631643c716887138d");
}
Пример #16
0
void run()
{
    test_begin_object();
    test_begin_object_white();
    test_end_object();
    test_end_object_white();
    test_object();
    test_array_begin();
    test_array_begin_white();
    test_array_end();
    test_array_end_white();
    test_array();
}
Пример #17
0
void test_refs_revparse__nth_parent(void)
{
	assert_invalid_spec("be3563a^-1");
	assert_invalid_spec("^");
	assert_invalid_spec("be3563a^{tree}^");
	assert_invalid_spec("point_to_blob^{blob}^");
	assert_invalid_spec("this doesn't make sense^1");

	test_object("be3563a^1", "9fd738e8f7967c078dceed8190330fc8648ee56a");
	test_object("be3563a^", "9fd738e8f7967c078dceed8190330fc8648ee56a");
	test_object("be3563a^2", "c47800c7266a2be04c571c04d5a6614691ea99bd");
	test_object("be3563a^1^1", "4a202b346bb0fb0db7eff3cffeb3c70babbd2045");
	test_object("be3563a^^", "4a202b346bb0fb0db7eff3cffeb3c70babbd2045");
	test_object("be3563a^2^1", "5b5b025afb0b4c913b4c338a42934a3863bf3644");
	test_object("be3563a^0", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
	test_object("be3563a^{commit}^", "9fd738e8f7967c078dceed8190330fc8648ee56a");

	test_object("be3563a^42", NULL);
}
Пример #18
0
void test_refs_revparse__reflog(void)
{
	cl_git_fail(git_revparse_single(&g_obj, g_repo, "@{-xyz}"));
	cl_git_fail(git_revparse_single(&g_obj, g_repo, "@{-0}"));
	cl_git_fail(git_revparse_single(&g_obj, g_repo, "@{1000}"));

	cl_assert_equal_i(GIT_ENOTFOUND, git_revparse_single(&g_obj, g_repo, "nope@{0}"));
	cl_assert_equal_i(GIT_ENOTFOUND, git_revparse_single(&g_obj, g_repo, "master@{31415}"));

	test_object("@{-2}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
	test_object("@{-1}", "a4a7dce85cf63874e984719f4fdd239f5145052f");
	test_object("master@{0}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
	test_object("master@{1}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
	test_object("@{0}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
	test_object("@{1}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
	test_object("master@{upstream}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
	test_object("master@{u}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
}
Пример #19
0
void test_refs_revparse__nth_parent(void)
{
	test_object("be3563a^1", "9fd738e8f7967c078dceed8190330fc8648ee56a");
	test_object("be3563a^", "9fd738e8f7967c078dceed8190330fc8648ee56a");
	test_object("be3563a^2", "c47800c7266a2be04c571c04d5a6614691ea99bd");
	test_object("be3563a^1^1", "4a202b346bb0fb0db7eff3cffeb3c70babbd2045");
	test_object("be3563a^2^1", "5b5b025afb0b4c913b4c338a42934a3863bf3644");
	test_object("be3563a^0", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");

	cl_assert_equal_i(GIT_ENOTFOUND, git_revparse_single(&g_obj, g_repo, "be3563a^42"));
}
Пример #20
0
void test_refs_revparse__upstream(void)
{
	assert_invalid_spec("e90810b@{u}");
	assert_invalid_spec("refs/tags/e90810b@{u}");
	test_object("refs/heads/e90810b@{u}", NULL);

	test_object("master@{upstream}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
	test_object("@{u}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
	test_object("master@{u}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
	test_object("heads/master@{u}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
	test_object("refs/heads/master@{u}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
}
Пример #21
0
void test_refs_revparse__linear_history(void)
{
	assert_invalid_spec("~");
	test_object("foo~bar", NULL);

	assert_invalid_spec("master~bar");
	assert_invalid_spec("master~-1");
	assert_invalid_spec("master~0bar");
	assert_invalid_spec("this doesn't make sense~2");
	assert_invalid_spec("be3563a^{tree}~");
	assert_invalid_spec("point_to_blob^{blob}~");

	test_object("master~0", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
	test_object("master~1", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
	test_object("master~2", "9fd738e8f7967c078dceed8190330fc8648ee56a");
	test_object("master~1~1", "9fd738e8f7967c078dceed8190330fc8648ee56a");
	test_object("master~~", "9fd738e8f7967c078dceed8190330fc8648ee56a");
}
Пример #22
0
void test_refs_revparse__colon(void)
{
	cl_git_fail(git_revparse_single(&g_obj, g_repo, ":/"));
	cl_git_fail(git_revparse_single(&g_obj, g_repo, ":2:README"));

	cl_assert_equal_i(GIT_ENOTFOUND, git_revparse_single(&g_obj, g_repo, ":/not found in any commit"));
	cl_assert_equal_i(GIT_ENOTFOUND, git_revparse_single(&g_obj, g_repo, "subtrees:ab/42.txt"));
	cl_assert_equal_i(GIT_ENOTFOUND, git_revparse_single(&g_obj, g_repo, "subtrees:ab/4.txt/nope"));
	cl_assert_equal_i(GIT_ENOTFOUND, git_revparse_single(&g_obj, g_repo, "subtrees:nope"));
	cl_assert_equal_i(GIT_ENOTFOUND, git_revparse_single(&g_obj, g_repo, "test/master^1:branch_file.txt"));

	/* Trees */
	test_object("master:", "944c0f6e4dfa41595e6eb3ceecdb14f50fe18162");
	test_object("subtrees:", "ae90f12eea699729ed24555e40b9fd669da12a12");
	test_object("subtrees:ab", "f1425cef211cc08caa31e7b545ffb232acb098c3");

	/* Blobs */
	test_object("subtrees:ab/4.txt", "d6c93164c249c8000205dd4ec5cbca1b516d487f");
	test_object("subtrees:ab/de/fgh/1.txt", "1f67fc4386b2d171e0d21be1c447e12660561f9b");
	test_object("master:README", "a8233120f6ad708f843d861ce2b7228ec4e3dec6");
	test_object("master:new.txt", "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd");
	test_object(":/Merge", "a4a7dce85cf63874e984719f4fdd239f5145052f");
	test_object(":/one", "c47800c7266a2be04c571c04d5a6614691ea99bd");
	test_object(":/packed commit t", "41bc8c69075bbdb46c5c6f0566cc8cc5b46e8bd9");
	test_object("test/master^2:branch_file.txt", "45b983be36b73c0788dc9cbcb76cbb80fc7bb057");
}
Пример #23
0
int main(int argc, char** argv) {
//   cppipc::comm_client client({"localhost:2181"}, "test");
  //cppipc::comm_client client({}, "tcp://127.0.0.1:19000");
  cppipc::comm_client client({}, 
                             "ipc:///tmp/cppipc_server_test");
  if (argc >= 2) {
    client.add_auth_method(std::make_shared<cppipc::authentication_token_method>(argv[1]));
  }
  client.start();
  client.add_status_watch(WATCH_COMM_SERVER_INFO, 
                          [](std::string message) {
                          std::cout << message << "\n";
                          });

  for (size_t i = 0;i < 100; ++i) {
  try { 
    test_object_proxy test_object(client);
    std::cout << test_object.ping("hello world") << "\n";

    std::cout << "5 + 1 = " << test_object.add_one(5, "hello") << "\n";
    std::cout << "5 + 5 = " << test_object.add(5, 5) << "\n";
    std::cout << "5 - 5 = " << test_object.subtract(5, 5) << "\n";
    std::cout << "return_one = " << test_object.return_one() << "\n";
    ASSERT_EQ(test_object.add(5, 5), 10);
    ASSERT_EQ(test_object.subtract(5, 5), 0);
  } catch (cppipc::reply_status status) {
    std::cout << "Exception: " << cppipc::reply_status_to_string(status) << "\n";
  } catch (const char* s) {
    std::cout << "Exception: " << s << "\n";
  }
  }

  std::shared_ptr<test_object_proxy> pika(std::make_shared<test_object_proxy>(client));
  std::shared_ptr<test_object_proxy> chu(std::make_shared<test_object_proxy>(client));

  pika->set_value(10);
  chu->set_value(5);
  ASSERT_EQ(pika->get_value(), 10);
  ASSERT_EQ(chu->get_value(), 5);

  pika->subtract_from(std::static_pointer_cast<test_object_base>(chu));
  ASSERT_EQ(pika->get_value(), 5);
  ASSERT_EQ(chu->get_value(), 5);

  chu->subtract_from(std::static_pointer_cast<test_object_base>(pika));
  ASSERT_EQ(pika->get_value(), 5);
  ASSERT_EQ(chu->get_value(), 0);

  pika->swap(std::static_pointer_cast<test_object_base>(chu));
  ASSERT_EQ(pika->get_value(), 0);
  ASSERT_EQ(chu->get_value(), 5);

  chu->swap(std::static_pointer_cast<test_object_base>(pika));
  ASSERT_EQ(pika->get_value(), 5);
  ASSERT_EQ(chu->get_value(), 0);

  chu->set_value(2);
  std::shared_ptr<test_object_proxy> p = std::dynamic_pointer_cast<test_object_proxy>(*pika - chu);
  ASSERT_NE(p.get(), NULL);
  ASSERT_EQ(p->get_value(), 3);

  // Test objects with reference count greater than 1
  std::shared_ptr<test_object_proxy> q = std::dynamic_pointer_cast<test_object_proxy>(*pika + chu);
  ASSERT_EQ(q->get_value(), 7);
  ASSERT_EQ(chu->get_value(), 7);
  ASSERT_EQ(pika->get_value(), 5);

  bool exception_caught = false;
  try {
    chu->an_exception();
  } catch (cppipc::ipcexception& except) {
    std::cout << except.what() << "\n";
    exception_caught = true;
  }

  ASSERT_TRUE(exception_caught);

  // ping test with increasing lengths
  test_object_proxy test_object(client);
  for (size_t i = 0;i <= 25; ++i) {
    size_t j = ((size_t)1 << i) - 1;
    graphlab::timer ti;
    std::cout << "Sending ping of length " << j << std::endl;
    std::string ret = test_object.return_big_object(j);
    std::cout << "Ping of length " << j << " RTT = " << ti.current_time() << "s" << std::endl;
    ASSERT_EQ(ret.length(), j);
  }
  p.reset();
}
int
main (int argc, char *argv[])
{
	CORBA_Object obj;
	CORBA_Environment ev;
        MateComponent_ServerInfoList *info;
        CORBA_Object ac;
        char *sort_by[4];
        char *query;
        int   i;
        GTimer *timer = g_timer_new ();
	MateComponent_EventSource event_source;
	
        g_thread_init (NULL);

	CORBA_exception_init (&ev);

        matecomponent_activation_object_directory_get (
                matecomponent_activation_username_get (),
                matecomponent_activation_hostname_get ());

	matecomponent_init (&argc, argv);
/*      putenv("MateComponent_BARRIER_INIT=1"); */


	event_source = matecomponent_activation_activate_from_id
                ("OAFIID:MateComponent_Activation_EventSource", 0, NULL, &ev);
        if (event_source != CORBA_OBJECT_NIL) {
		passed++;
		fprintf (stderr, "PASSED %d of %d: Activation event source okay\n",
                         passed + failed, TOTAL_TEST_SCORE);
   	        matecomponent_event_source_client_add_listener (event_source, listener_cb,
                                                         "MateComponent/ObjectDirectory", &ev, NULL);
        } else {
		failed++;
		fprintf (stderr, "FAILED %d of %d: Activation event source not found\n",
                         passed + failed, TOTAL_TEST_SCORE);
	}


        race_base_init ();

        sort_by[0] = "prefer_by_list_order(iid, ["
                "'OAFIID:nautilus_file_manager_icon_view:42681b21-d5ca-4837-87d2-394d88ecc058',"
                "'OAFIID:nautilus_file_manager_list_view:521e489d-0662-4ad7-ac3a-832deabe111c',"
                "'OAFIID:nautilus_music_view:9456b5d2-60a8-407f-a56e-d561e1821391'])";
        sort_by[1] = "iid != 'OAFIID:nautilus_content_loser:95901458-c68b-43aa-aaca-870ced11062d'";
        sort_by[2] = "iid != 'OAFIID:nautilus_sample_content_view:45c746bc-7d64-4346-90d5-6410463b43ae'";
        sort_by[3] = NULL;

        query = "( (((repo_ids.has_all (['IDL:MateComponent/Control:1.0',"
                "'IDL:Nautilus/View:1.0']) OR (repo_ids.has_one "
                "(['IDL:MateComponent/Control:1.0','IDL:MateComponent/Embeddable:1.0']) AND "
                "repo_ids.has_one (['IDL:MateComponent/PersistStream:1.0', "
                "'IDL:MateComponent/ProgressiveDataSink:1.0', "
                "'IDL:MateComponent/PersistFile:1.0']))) AND (matecomponent:supported_mime_types.defined () OR "
                "matecomponent:supported_uri_schemes.defined () OR "
                "matecomponent:additional_uri_schemes.defined ()) AND "
                "(((NOT matecomponent:supported_mime_types.defined () OR "
                "matecomponent:supported_mime_types.has ('x-directory/normal') OR "
                "matecomponent:supported_mime_types.has ('x-directory/*') OR "
                "matecomponent:supported_mime_types.has ('*/*')) AND "
                "(NOT matecomponent:supported_uri_schemes.defined () OR "
                "matecomponent:supported_uri_schemes.has ('file') OR "
                "matecomponent:supported_uri_schemes.has ('*'))) OR "
                "(matecomponent:additional_uri_schemes.has ('file') OR "
                "matecomponent:additional_uri_schemes.has ('*'))) AND "
                "nautilus:view_as_name.defined ()) OR false) AND "
                "(has (['OAFIID:nautilus_file_manager_icon_view:42681b21-d5ca-4837-87d2-394d88ecc058', "
                "'OAFIID:nautilus_file_manager_list_view:521e489d-0662-4ad7-ac3a-832deabe111c'], iid)) ) AND "
                "(NOT test_only.defined() OR NOT test_only)";

        ac = matecomponent_activation_activation_context_get ();

        g_timer_start (timer);

        info = matecomponent_activation_query (query, sort_by, &ev);

        for (i = 0; i < 1000; i++) {
                MateComponent_ServerInfoList *copy;
                copy = MateComponent_ServerInfoList_duplicate (info);
                CORBA_free (copy);
        }
        g_timer_stop (timer);

        fprintf (stderr, "Time to query '%g'\n", g_timer_elapsed (timer, NULL));
        if (ev._major == CORBA_NO_EXCEPTION) {
		passed++;
		fprintf (stderr, "PASSED %d of %d: timed query\n", passed + failed, TOTAL_TEST_SCORE);
        } else {
		failed++;
		fprintf (stderr, "FAILED %d of %d: timed query\n", passed + failed, TOTAL_TEST_SCORE);
                CORBA_exception_free (&ev);
	}

        /*
         *    We wait to see if the server (sever)
         * timeout is mis-behaving [ at this stage we
         * have not registered anything with the server ]
         */
        fprintf (stderr, "Waiting to see if the server erroneously quits\n");
        g_usleep (SERVER_IDLE_QUIT_TIMEOUT * 2 * 1000);
        g_assert (MateCORBA_small_get_connection_status (ac) ==
                  MATECORBA_CONNECTION_CONNECTED);

        race_empty (&ev);
	
	
	
	

	obj = matecomponent_activation_activate_from_id ("OAFIID:Empty:19991025", 0, NULL, &ev);
        if (test_object (obj, &ev, "from id") && test_empty (obj, &ev, "from id")) {
		passed++;
		fprintf (stderr, "PASSED %d of %d: IID activation\n", passed + failed, TOTAL_TEST_SCORE);
        } else {
		failed++;
		fprintf (stderr, "FAILED %d of %d: IID activation\n", passed + failed, TOTAL_TEST_SCORE);
	}

	obj = matecomponent_activation_activate_from_id ("OAFAID:[OAFIID:Empty:19991025]", 0, NULL, &ev);
        if (test_object (obj, &ev, "from aid") && test_empty (obj, &ev, "from aid")) {
		passed++;
		fprintf (stderr, "PASSED %d of %d: AID activation\n", passed + failed, TOTAL_TEST_SCORE);
        } else {
		failed++;
		fprintf (stderr, "FAILED %d of %d: AID activation\n", passed + failed, TOTAL_TEST_SCORE);
	}

	obj = matecomponent_activation_activate_from_id ("OAFAID:[OAFIID:Plugin:20010713]",  0, NULL, &ev);
	if (test_object (obj, &ev, "from aid") && test_plugin (obj, &ev, "from aid")) {
		passed++;
		fprintf (stderr, "PASSED %d of %d: plugin activation\n", passed + failed, TOTAL_TEST_SCORE);
        } else {
		failed++;
		fprintf (stderr, "FAILED %d of %d: plugin activation\n", passed + failed, TOTAL_TEST_SCORE);
	}

        obj = matecomponent_activation_activate_from_id ("OAFIID:Bogus:20000526", 0, NULL, &ev);
        if (ev._major != CORBA_NO_EXCEPTION) {
		passed++;
		fprintf (stderr, "PASSED %d of %d: Broken link test : %s\n",
			 passed + failed, TOTAL_TEST_SCORE, matecomponent_activation_exception_id (&ev));
                CORBA_exception_free (&ev);
        } else {
		failed++;
		fprintf (stderr, "FAILED %d of %d: Broken link test\n", passed + failed, TOTAL_TEST_SCORE);
	}

        if (test_matecomponent_activation_server (&ev, "with broken factory link")) {
		passed++;
		fprintf (stderr, "PASSED %d of %d: activation server okay\n", passed + failed, TOTAL_TEST_SCORE);
        } else {
		failed++;
		fprintf (stderr, "FAILED %d of %d: activation server okay\n", passed + failed, TOTAL_TEST_SCORE);
	}

        fprintf (stderr, "Broken exe test ");
        obj = matecomponent_activation_activate_from_id ("OAFIID:Broken:20000530", 0, NULL, &ev);
        if (ev._major != CORBA_NO_EXCEPTION) {
		passed++;
		fprintf (stderr, "PASSED %d of %d: Broken exe test : %s\n",
			 passed + failed, TOTAL_TEST_SCORE, matecomponent_activation_exception_id (&ev));
                CORBA_exception_free (&ev);
        } else {
		failed++;
		fprintf (stderr, "FAILED %d of %d: Broken exe test\n", passed + failed, TOTAL_TEST_SCORE);
	}

        if (test_matecomponent_activation_server (&ev, "with broken factory link")) {
		passed++;
		fprintf (stderr, "PASSED %d of %d: activation server okay\n", passed + failed, TOTAL_TEST_SCORE);
        } else {
		failed++;
		fprintf (stderr, "FAILED %d of %d: activation server okay\n", passed + failed, TOTAL_TEST_SCORE);
	}

        obj = matecomponent_activation_activate_from_id ("OAFIID:Circular:20000530", 0, NULL, &ev);
        if (ev._major != CORBA_NO_EXCEPTION) {
		passed++;
		fprintf (stderr, "PASSED %d of %d: Circular link test : %s\n",
			 passed + failed, TOTAL_TEST_SCORE, matecomponent_activation_exception_id (&ev));
                CORBA_exception_free (&ev);
        } else {
		failed++;
		fprintf (stderr, "FAILED %d of %d: Circular link test\n", passed + failed, TOTAL_TEST_SCORE);
	}

        if (test_matecomponent_activation_server (&ev, "with broken factory link")) {
		passed++;
		fprintf (stderr, "PASSED %d of %d: activation server okay\n", passed + failed, TOTAL_TEST_SCORE);
        } else {
		failed++;
		fprintf (stderr, "FAILED %d of %d: activation server okay\n", passed + failed, TOTAL_TEST_SCORE);
	}

        obj = matecomponent_activation_activate_from_id ("OAFIID:NotInServer:20000717", 0, NULL, &ev);
        if (ev._major != CORBA_NO_EXCEPTION) {
		passed++;
		fprintf (stderr, "PASSED %d of %d: Server that doesn't register IID test : %s\n",
			 passed + failed, TOTAL_TEST_SCORE, matecomponent_activation_exception_id (&ev));
                CORBA_exception_free (&ev);
        } else {
		failed++;
		fprintf (stderr, "FAILED %d of %d: Server that doesn't register IID test\n",
			 passed + failed, TOTAL_TEST_SCORE);
	}

        if (test_matecomponent_activation_server (&ev, "with non-registering server")) {
		passed++;
		fprintf (stderr, "PASSED %d of %d: activation server okay\n", passed + failed, TOTAL_TEST_SCORE);
        } else {
		failed++;
		fprintf (stderr, "FAILED %d of %d: activation server okay\n", passed + failed, TOTAL_TEST_SCORE);
	}

        obj = matecomponent_activation_activate_from_id ("OAFIID:BrokenNoType:20000808", 0, NULL, &ev);
        if (ev._major != CORBA_NO_EXCEPTION) {
		failed++;
		fprintf (stderr, "FAILED %d of %d: Server with IID but no type or location : %s\n",
			 passed + failed, TOTAL_TEST_SCORE, matecomponent_activation_exception_id (&ev));
                CORBA_exception_free (&ev);
        } else if (obj) {
		failed++;
		fprintf (stderr, "FAILED %d of %d: Server with IID but no type or location\n",
			 passed + failed, TOTAL_TEST_SCORE);
        } else {
                passed++;
		fprintf (stderr, "PASSED %d of %d: Server with IID but no type or location\n",
			 passed + failed, TOTAL_TEST_SCORE);
        }

        if (test_matecomponent_activation_server (&ev, "with no-type/loc server")) {
		passed++;
		fprintf (stderr, "PASSED %d of %d: activation server okay\n", passed + failed, TOTAL_TEST_SCORE);
        } else {
		failed++;
		fprintf (stderr, "FAILED %d of %d: activation server okay\n", passed + failed, TOTAL_TEST_SCORE);
	}

        fprintf (stderr, "\n%d of %d tests passed (%s)\n", passed,
                 TOTAL_TEST_SCORE,
                 passed == TOTAL_TEST_SCORE? "All": "some failures");

        if (passed < (TOTAL_TEST_SCORE * 2 / 3)) {
                fprintf (stderr, "It looks like you have not installed broken.server "
                         "into ${prefix}/share/matecomponent-activation/, this must be done "
                         "by hand to avoid problems with normal operation.\n");
		fprintf (stderr, "Another possibility is that you failed to kill "
			 "matecomponent_activation_server before running make check; try running matecomponent-slay.\n");
        }

        if (name_service != CORBA_OBJECT_NIL)
                CORBA_Object_release (name_service, &ev);
        
        if (event_source != CORBA_OBJECT_NIL)
		CORBA_Object_release (event_source, &ev);

	CORBA_exception_free (&ev);

        if (passed == TOTAL_TEST_SCORE) {
                if (matecomponent_debug_shutdown ()) {
                        return 0;
                } else {
                        return 1;
                }
        } else {
                return 1;
        }
}
Пример #25
0
int main()
{
    sio << "short: " << sizeof(short) << "  long: " << sizeof(long)
        << "  long long: " << sizeof(long long) << "  int: " << sizeof(int)
        << "  void*: " << sizeof(void*) << "  float: " << sizeof(float)
        << "  double: " << sizeof(double) << '\n';
    sio << "integer: " << sizeof(integer) << "  memint: " << sizeof(memint)
        << "  real: " << sizeof(real) << "  variant: " << sizeof(variant)
        << "  object: " << sizeof(object) << "  rtobject: " << sizeof(rtobject) << '\n';
    sio << "stateobj: " << sizeof(stateobj) << "  Type: " << sizeof(Type)
        << "  State: " << sizeof(State) << "  opcodes: " << opMaxCode << '\n';

    check(sizeof(memint) == sizeof(void*));
    check(sizeof(memint) == sizeof(size_t));

#ifdef SHN_64
    check(sizeof(integer) == 8);
    check(sizeof(variant) <= 16);
#else
    check(sizeof(integer) == 4);
    check(sizeof(variant) <= 12);
#endif

    initRuntime();
    initTypeSys();
    initVm();

    int exitcode = 0;
    try
    {
        test_common();
        test_object();
        test_ordset();
        test_bytevec();
        test_string();
        test_strutils();
        test_podvec();
        test_vector();
        test_dict();
        test_set();
        test_symtbl();
        test_variant();
        test_fifos();
        test_parser();
//        test_typesys();
//        test_codegen();
    }
    catch (exception& e)
    {
        fprintf(stderr, "Exception: %s\n", e.what());
        exitcode = 201;
    }

    doneVm();
    doneTypeSys();
    doneRuntime();

    if (object::allocated != 0)
    {
        fprintf(stderr, "Error: object::allocated = %d\n", object::allocated);
        exitcode = 202;
    }

    return exitcode;
}
Пример #26
0
void test_refs_revparse__not_tag(void)
{
	test_object("point_to_blob^{}", "1385f264afb75a56a5bec74243be9b367ba4ca08");
	test_object("wrapped_tag^{}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
}
Пример #27
0
void test_refs_revparse__describe_output(void)
{
	test_object("blah-7-gc47800c", "c47800c7266a2be04c571c04d5a6614691ea99bd");
	test_object("not-good", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
}
Пример #28
0
void test_refs_revparse__partial_refs(void)
{
	test_object("point_to_blob", "1385f264afb75a56a5bec74243be9b367ba4ca08");
	test_object("packed-test", "4a202b346bb0fb0db7eff3cffeb3c70babbd2045");
	test_object("br2", "a4a7dce85cf63874e984719f4fdd239f5145052f");
}
Пример #29
0
void test_refs_revparse__full_refs(void)
{
	test_object("refs/heads/master", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
	test_object("refs/heads/test", "e90810b8df3e80c413d903f631643c716887138d");
	test_object("refs/tags/test", "b25fa35b38051e4ae45d4222e795f9df2e43f1d1");
}
Пример #30
0
void test_refs_revparse__shas(void)
{
	test_object("c47800c7266a2be04c571c04d5a6614691ea99bd", "c47800c7266a2be04c571c04d5a6614691ea99bd");
	test_object("c47800c", "c47800c7266a2be04c571c04d5a6614691ea99bd");
}