Ejemplo n.º 1
0
static int
wait_for_pid(pid_t pid, term_t code, wait_options *opts)
{ HANDLE *h;

  if ( (h=find_process_from_pid(pid, "process_wait")) )
  { ULONG rc;
    DWORD timeout;
    int wc;

    if ( opts->has_timeout )
      timeout = (DWORD)(opts->timeout * 1000.0);
    else
      timeout = INFINITE;

    if ( !(wc=wait_process_handle(h, &rc, timeout)) )
      return FALSE;
    if ( wc == WP_TIMEOUT )
      return PL_unify_atom(code, ATOM_timeout);

    unregister_process(pid);

    return PL_unify_term(code,
			 PL_FUNCTOR, FUNCTOR_exit1,
			   PL_LONG, rc);
  } else
  { return FALSE;
  }
}
Ejemplo n.º 2
0
static bool interface_tests_i(const char* pszHost)
{
	output("\n");

	for (const char** pszDlls = get_dlls(); *pszDlls; ++pszDlls)
	{
		bool bSkipped;
		bool res = do_library_test(make_absolute(*pszDlls),pszHost,bSkipped);

		unregister_library("/Local User");

		if (res && !bSkipped)
			output("[Ok]\n");
	}

	output("  %-46s","Result");

	for (const char** pszExes = get_exes(); *pszExes; ++pszExes)
	{
		bool bSkipped;
		bool res = do_process_test(make_absolute(*pszExes),pszHost,bSkipped);

		unregister_process("/Local User");

		if (res && !bSkipped)
			output("[Ok]\n");
	}

	output("  %-46s","Result");
	return true;
}
Ejemplo n.º 3
0
bool interface_process_tests()
{
	output("\n");

	for (const char** pszExes = get_exes(); *pszExes; ++pszExes)
	{
		// Register the exe
		Omega::string_t strModulePath = make_absolute(*pszExes);
		output("  %-45s ",strModulePath.c_str());

		bool bSkipped;
		bool res = register_process("/Local User",strModulePath,bSkipped);
		if (bSkipped)
			continue;

		if (res)
		{
			output("\n");

			res = do_local_process_test("/Local User");

			unregister_process("/Local User");

			if (res)
				output("[Ok]");
		}

		res = register_process("/All Users",strModulePath,bSkipped);
		if (res && !bSkipped)
		{
			output("\n");

			res = do_local_process_test("/All Users");

			unregister_process("/All Users");

			if (res)
				output("[Ok]\n");
		}
	}

	output("  %-46s","Result");

	return true;
}
Ejemplo n.º 4
0
static bool do_local_process_test(const Omega::string_t& strPrefix)
{
	output("    %-43s ",("'" + strPrefix + "/' registry key").c_str());

	// Test the simplest case
	OTL::ObjectPtr<Omega::TestSuite::ISimpleTest> ptrSimpleTest(Omega::TestSuite::OID_TestProcess,Omega::Activation::Process);
	TEST(ptrSimpleTest);
	interface_tests(ptrSimpleTest);

	// Kill the running version
	try
	{
		ptrSimpleTest->Abort();
	}
	catch (Omega::Remoting::IChannelClosedException* pE)
	{
		add_success();
		pE->Release();
	}

	ptrSimpleTest = OTL::ObjectPtr<Omega::TestSuite::ISimpleTest>("Test.Process");
	TEST(ptrSimpleTest);
	interface_tests(ptrSimpleTest);

	// Kill the running version
	try
	{
		ptrSimpleTest->Abort();
	}
	catch (Omega::Remoting::IChannelClosedException* pE)
	{
		add_success();
		pE->Release();
	}

	// Test unregistering
	TEST(unregister_process(strPrefix));

	// Check its gone
	try
	{
		ptrSimpleTest = OTL::ObjectPtr<Omega::TestSuite::ISimpleTest>("Test.Process");
	}
	catch (Omega::INotFoundException* pE)
	{
		add_success();
		pE->Release();
	}

	return true;
}
Ejemplo n.º 5
0
static bool do_process_test(const Omega::string_t& strModulePath, const char* pszEndpoint, bool& bSkipped)
{
	output("  %-45s ",strModulePath.c_str());

	// Register the exe
	TEST(register_process("/Local User",strModulePath,bSkipped));
	if (bSkipped)
		return true;

	OTL::ObjectPtr<Omega::TestSuite::ISimpleTest> ptrSimpleTest("Test.Process@" + Omega::string_t(pszEndpoint));
	TEST(ptrSimpleTest);
	interface_tests(ptrSimpleTest);

	TEST(unregister_process("/Local User"));

	return true;
}