Example #1
0
int main(int argc, char ** argv)
{
	bool success_all = true;
	bool unbalance_check = true;
	struct busy_data busy;
	const char * exec_name = argv[0];

	os_init(OS_INIT_NOFREQUENCY);
	printf("# %s Created by Olivier Cozette <*****@*****.**>\n# Copyright (C) 2013  ARM Limited\n", argv[0]);

	if ((argc > 1) && (strcmp(argv[1], "NO_BALANCE_CHECK") == 0))
	{
		argv++;
		argc--;
		unbalance_check = false;
	}

	if (argc < 5)
	{
		printf("#Usage %s [NO_BALANCE_CHECK] TOTAL_SEQUENTIAL_TIME RUNNING_TIME SLEEPING_TIME NICE_PID0 [NICE_PID1] ...\n", exec_name);
		printf("#\tif NO_BALANCED_CHECK is given, even unbalanced thread won't raise a FAILED\n");
		os_cleanup();
		exit(1);
	}

	if (!main_init(&busy, argc, argv))
	{
		printf("# error :%s\n", busy.error_str);
		main_cleanup(&busy);
		os_cleanup();
		exit(1);
	}

	if (!main_launch(&busy))
		success_all = false;
	if (!main_wait(&busy))
		success_all = false;
	if (success_all)
		printf("SUCCESS before checking if tasks were well balanced\n");
	if (!main_check(&busy))
	{
		if (unbalance_check)
			success_all = false;
		else
			printf("#Seen as unbalanced or not using all the cpu time, but this doesn't affect the result\n");
	}

	main_cleanup(&busy);
	os_cleanup();
	if (!success_all)
	{
		printf("FAILED\n");
		exit(1);
	}
	printf("SUCCESS\n");
	return 0;
}
void test::FSTestFixture::TearDown() {
	if (_initFlags & INIT_SHIPS) {
		ship_close();
	}

	if (_initFlags & INIT_GRAPHICS) {
		io::mouse::CursorManager::shutdown();

		bm_unload_all();

		gr_close(nullptr);
	}

	cfile_close();

	timer_close();

	lcl_close();

	os_cleanup();

#ifndef NDEBUG
	outwnd_close();
#endif

	// although the comment in cmdline.cpp said this isn't needed,
	// Valgrind disagrees (quite possibly incorrectly), but this is just cleaner
	if (Cmdline_mod != NULL) {
		delete[] Cmdline_mod;
		Cmdline_mod = NULL;
	}
}
Example #3
0
int main(int argc, char* argv[])
{
   if (argc < 2)
   {
      puts("COM port argument missing.");
      return 1;
   }

   if (os_initialize() < 0)
   {
      puts("Failed to initialize serial base");
      return 2;
   }

   myChannel = io_openSerialPort(argv[1], 115200, NULL);
   if (! myChannel)
   {
      printf("Failed to open port %s\n", argv[1]);
      goto done;
   }

   os_waitForKeyboardInterrupt();

done:

   if (myChannel)
   {
      io_closePort(myChannel);
   }

   os_cleanup();

   return 0;
}
void test::FSTestFixture::TearDown() {
	if (_initFlags & INIT_CFILE) {
		if (_initFlags & INIT_SHIPS) {
			ship_close();
		}

		if (_initFlags & INIT_GRAPHICS) {
			if (_initFlags & INIT_FONTS) {
				font::close();
			}

			io::mouse::CursorManager::shutdown();

			bm_unload_all();

			gr_close();
		}

		if (_initFlags & INIT_MOD_TABLE) {
			// Reset mod settings again so that subsequent tests don't get broken
			mod_table_reset();
		}

		cfile_close();
	}

	timer_close();

	lcl_close();

	os_cleanup();

#ifndef NDEBUG
	outwnd_close();
#endif

	// although the comment in cmdline.cpp said this isn't needed,
	// Valgrind disagrees (quite possibly incorrectly), but this is just cleaner
	if (Cmdline_mod != NULL) {
		delete[] Cmdline_mod;
		Cmdline_mod = NULL;
	}
}
Example #5
0
int main(int argc, char* argv[])
{
   int status = -1;

   if (argc < 2)
   {
      puts("COM port argument missing.");
      return 1;
   }

   if (os_initialize() < 0)
   {
      puts("Failed to initialize serial base");
      return 2;
   }

   io_setDebugLevel(5);

   myChannel = io_openSerialPort(argv[1], 115200, NULL);
   if (! myChannel)
   {
      printf("Failed to open port %s\n", argv[1]);
      goto done;
   }

   io_sendData(myChannel, HELLO, sizeof(HELLO) - 1);

   os_waitForKeyboardInterrupt();

   status = 0;

done:

   if (myChannel)
   {
      io_closePort(myChannel);
   }

   os_cleanup();

   return status;
}
Example #6
0
/**************************************************************************
   Description   : Deinitialization of the Yasdi-Shared-Library
   Parameter     : ---
   Return-Value  : ---
   Changes       : Author, Date, Version, Reason
                   ********************************************************
                   PRUESSING, 23.12.2001, 1.0, Created
**************************************************************************/
SHARED_FUNCTION void yasdiShutdown(void) 
{
   YASDI_DEBUG(( VERBOSE_MESSAGE,
                 "YASDI calling yasdiShutdown...\n" ));
                 
   /*Using Statistic Writer?*/
   TStatisticWriter_Destructor();

   //TSMAData-Destructor...
   TSMAData_destructor();

   //destroy the repository...
   TRepository_Destroy();

   YASDI_DEBUG(( VERBOSE_MESSAGE,
                 "Yasdi-Library is down...\n" ));

   //cleanup os layer (close debug out system)
   os_cleanup();
}
Example #7
0
int
mdns_cleanup(struct mdns_ctx *ctx)
{
        if (ctx != NULL) {
                if (ctx->sock != INVALID_SOCKET) {
                        os_close(ctx->sock);
                        ctx->sock = INVALID_SOCKET;
                }
                if (ctx->services) {
                        struct mdns_svc *svc;

                        while ((svc = ctx->services)) {
                                ctx->services = ctx->services->next;
                                if (svc->name) free(svc->name);
                                free(svc);
                        }
                }
                free(ctx);
        }
        if (os_cleanup() < 0)
                return (MDNS_NETERR);
        return (0);
}
Example #8
0
File: app.c Project: zeppo21/demo_c
/*
 * Application cleanup.
 */
BOOL_t appClose()
{
	return (BOOL_t) os_cleanup();
}