Beispiel #1
0
int test_staticlink()
{
  char *ptr = "Hello world!";
  char *np = 0;
  int i = 5;
  unsigned int bs = sizeof(int)*8;
  int mi;
  char buf[80];

  int a = 0;

  a = test_global();  // gI = 100
  printf("global variable gI = %d", a);
  if (a == 100)
    printf(", PASS\n");
  else
    printf(", FAIL\n");
  a = select_1();
  printf("select_1() = %d\n", a); // a = 1
  a = select_2();
  printf("select_2() = %d\n", a); // a = 1
  a = select_3();
  printf("select_3() = %d\n", a); // a = 1
  a = test_select_global_pic(); // test global of pic llc -O1 option
  printf("test_select_global_pic() = %d", a); // a = 100
  if (a == 100)
    printf(", PASS\n");
  else
    printf(", FAIL\n");
  a = test_func_arg_struct();
  a = test_contructor();
  a = test_template();
  printf("test_template() = %d", a); // a = 15
  if (a == 15)
    printf(", PASS\n");
  else
    printf(", FAIL\n");
  a = test_alloc();  // 31
  printf("test_alloc() = %d", a);
  if (a == 31)
    printf(", PASS\n");
  else
    printf(", FAIL\n");
  a = test_inlineasm();
  printf("test_inlineasm() = %d", a); // a = 53
  if (a == 53)
    printf(", PASS\n");
  else
    printf(", FAIL\n");

  return 0;
}
Beispiel #2
0
int main(int argc, char *argv[])
{
	printf("==== start\n");

	if (sthread_init())
		err(1, "sthread_init()");

	printf("==== Basic sthread\n");
	test_sthread();
	test_sthread();

	printf("==== Globals\n");
	_global = 2;
	test_global();
	if (_global != 2)
		errx(1, "global in master %d\n", _global);
	test_global();

	printf("==== Stack\n");
	test_stack();
	test_stack();

	printf("==== smalloc\n");
	test_smalloc();

	printf("==== fd\n");
	test_fd();

	printf("==== syscall\n");
	test_syscall();

	printf("==== parallel\n");
	test_parallel();

	printf("==== end\n");
	exit(0);
}