예제 #1
0
파일: main.c 프로젝트: bmarcot/vega-test
int main(void)
{
	struct sigaction act;
	struct sigevent sevp;
	struct itimerspec val;
	timer_t timerid = {0};

	act.sa_sigaction = event;
	act.sa_flags = SA_SIGINFO;
	sigaction(SIGUSR1, &act, NULL);

	sevp.sigev_notify = SIGEV_SIGNAL;
	sevp.sigev_signo = SIGUSR1;

	val.it_value.tv_sec = 1;
	timer_create(1, &sevp, &timerid);
	timer_settime(timerid, 0, &val, NULL);

	if (pause() != -EINTR)
		TEST_EXIT(1);
	if (!i)
		TEST_EXIT(1);

	TEST_EXIT(0);
}
예제 #2
0
    ParMetisGraph::ParMetisGraph(ParMetisMesh* parMesh,
                                 MPI::Intracomm* comm,
                                 int ncommonnodes)
      : parMetisMesh(parMesh)
    {
      FUNCNAME("ParMetisGraph::ParMetisGraph()");

      TEST_EXIT(parMesh)("No ParMetisMesh defined!\n");
      TEST_EXIT(comm)("No MPI communicator defined!\n");

      int numflag = 0;

      if (ncommonnodes == -1)
        ncommonnodes = parMetisMesh->getDim();

      MPI_Comm tmpComm = MPI_Comm(*comm);

      ParMETIS_V3_Mesh2Dual(parMetisMesh->getElementDist(),
                            parMetisMesh->getElementPtr(),
                            parMetisMesh->getElementInd(),
                            &numflag,
                            &ncommonnodes,
                            &xadj,
                            &adjncy,
                            &tmpComm);
    }
예제 #3
0
  void RosenbrockStationary::addJacobianOperator(Operator& op, int row, int col,
      double* factor, double* estFactor)
  {
    FUNCNAME("RosenbrockStationary::addJacobianOperator()");

    TEST_EXIT(factor == NULL)("Not yet implemented!\n");
    TEST_EXIT(estFactor == NULL)("Not yet implemented!\n");

    ProblemStat::addMatrixOperator(op, row, col, &minusOne, &minusOne);
  }
예제 #4
0
파일: main.c 프로젝트: bmarcot/vega-test
int main()
{
	int pid = getpid();

	if (setpriority(PRIO_PROCESS, pid, 16))
		TEST_EXIT(1);
	if (getpriority(PRIO_PROCESS, pid) != 16)
		TEST_EXIT(1);

	TEST_EXIT(0);
}
예제 #5
0
파일: main.c 프로젝트: bmarcot/vega-test
static void *fn(void *arg)
{
	struct timespec rem, req = {
		.tv_sec = 1,
		.tv_nsec = 0
	};

	other_tid = gettid();

	// The syscall will be interrupted by the main thread
	if (nanosleep(&req, &rem) != -1)
		TEST_EXIT(1);
	if (errno != EINTR)
		TEST_EXIT(1);

	// The handler for the signal must have run after the nanosleep()
	// syscall was interrupted
	if (!signal_serviced)
		TEST_EXIT(1);

	// Test is interrupted before timer has expired, there must
	// be some time remaining
	if (!rem.tv_sec && !rem.tv_nsec)
		TEST_EXIT(1);

	return 0;
}

int main(void)
{
	struct sigaction act = {
		.sa_handler = handler,
		.sa_flags = 0,
	};
	if (sigaction(SIGUSR1, &act, NULL))
		TEST_EXIT(1);

	pthread_t thread;
	if (pthread_create(&thread, NULL, fn, NULL))
		TEST_EXIT(1);

	// The other thread startup might be delayed depending on the
	// scheduler's prolicy
	while (other_tid == -1)
		sched_yield();

	// Interrupt the other thread which is blocking in a sleep operation
	if (tgkill(getpid(), other_tid, SIGUSR1))
		TEST_EXIT(1);

	// Join to make sure there other thread was interrupted with
	// some time remaining
	if (pthread_join(thread, NULL))
		TEST_EXIT(1);

	TEST_EXIT(0);
}
예제 #6
0
파일: main.c 프로젝트: bmarcot/vega-test
int main()
{
	void *p, *q;
	unsigned long order = size_to_page_order(256);

	if ((p = alloc_pages(order)) == NULL)
		TEST_EXIT(1);
	free_pages((unsigned long)p, order);

	/* same page should be reallocated */
	if ((q = alloc_pages(order)) != p)
		TEST_EXIT(1);

	TEST_EXIT(0);
}
예제 #7
0
파일: main.c 프로젝트: bmarcot/vega-test
int main()
{
	pthread_t thread;

	for (int i = 0; i < 1000; i++) {
		if (pthread_create(&thread, NULL, fn, NULL)) {
			test_printf("failed: can't create new posix thread.\n");
			TEST_EXIT(1);
		}
		pthread_detach(thread);
		sched_yield();
	}
	test_printf("\n");
	TEST_EXIT(0);
}
예제 #8
0
파일: llrintf4.c 프로젝트: BlackYoup/medusa
int main()
{
	TEST_SET_START("20060918101000NM","NM", "llrintf4");

//   unsigned long i11 = 0x5efffffful; // 9223371487098961920
//   unsigned long i12 = 0xdefffffful; //-9223371487098961920
//   unsigned long i11 = 0x49fffffful; //2097151.875000
//   unsigned long i12 = 0x4a7ffffful; //4194303.750000

//   float x0  = hide_float(-FLT_MAX);           // -Inf
//   float x1  = hide_float(FLT_MAX);            // Inf
   float x2  = hide_float(0.0);                  // +0
   float x3  = hide_float(-0.0);                 // -0
//   float x4  = hide_float(NANF);            // NaN -> NaN
   float x5  = hide_float( 0.5);
   float x6  = hide_float(-0.5);
   float x7  = hide_float(-0.499999);
   float x8  = hide_float( 0.499999);
   float x9  = hide_float(-999999.5);
   float x10 = hide_float( 999999.5);
//   float x11 = hide_float(make_float(i11));
//   float x12 = hide_float(make_float(i12));
   float x11 = hide_float( 9223371487098961920.);
   float x12 = hide_float(-9223371487098961920.);
   float x13 = (0.0 - FLT_MIN);
   float x14 = FLT_MIN;
   float x15 = hide_float(-2097151.875000);
   float x16 = hide_float(-4194303.750000);
   float x17 = hide_float( 4194303.750000);
   float x18 = hide_float( 2097151.875000);

	vec_float4  x0_v = ((vec_float4){ x2, x3, x5, x6});
	llroundf4_t r0_v = set_llrintf4_t(0,  0,  0, 0);

	vec_float4  x1_v = ((vec_float4){ x7, x8,       x9,     x10});
	llroundf4_t r1_v = set_llrintf4_t(0,  0, -999999, 999999);

	vec_float4  x2_v = ((vec_float4){                    x11,                    x12, x13, x14});
	llroundf4_t r2_v = set_llrintf4_t(9223371487098961920ll, -9223371487098961920ll,    0,  0);

	vec_float4  x3_v = ((vec_float4){       x15,      x16,     x17,     x18});
	llroundf4_t r3_v = set_llrintf4_t(-2097151, -4194303, 4194303, 2097151);

	llroundf4_t  res_v;

   TEST_START("llrintf4");
   res_v = llrintf4 (x0_v);
   TEST_CHECK("20060918101001NM", allequal_llroundf4( res_v, r0_v ), 0);
   res_v = llrintf4 (x1_v);
   TEST_CHECK("20060918101002NM", allequal_llroundf4( res_v, r1_v ), 0);
   res_v = llrintf4 (x2_v);
   TEST_CHECK("20060918101003NM", allequal_llroundf4( res_v, r2_v ), 0);
   res_v = llrintf4 (x3_v);
   TEST_CHECK("20060918101004NM", allequal_llroundf4( res_v, r3_v ), 0);

   TEST_SET_DONE();

   TEST_EXIT();

}
예제 #9
0
  ElInfo* ParametricFirstOrder::addParametricInfo(ElInfo* elInfo)
  {
    elInfo->setParametric(true);
    const int dow = Global::getGeo(WORLD);
    Element* element = elInfo->getElement();
    const DegreeOfFreedom** dof = element->getDof();

    for (int i = 0; i < elInfo->getElement()->getGeo(VERTEX); i++)
    {
      if (elInfo->getFillFlag().isSet(Mesh::FILL_COORDS))
        for (int j = 0; j < dow; j++)
          elInfo->getCoord(i)[j] = (*(*dofCoords_)[j])[dof[i][0]];

      if (elInfo->getFillFlag().isSet(Mesh::FILL_OPP_COORDS))
      {
        TEST_EXIT(elInfo->getFillFlag().isSet(Mesh::FILL_NEIGH))
        ("FILL_NEIGH not set\n");

        if (elInfo->getNeighbour(i))
        {
          const DegreeOfFreedom** neighDof = elInfo->getNeighbour(i)->getDof();
          for (int j = 0; j < dow; j++)
            elInfo->getOppCoord(i)[j] =
              (*(*dofCoords_)[j])[neighDof[elInfo->getOppVertex(i)][0]];
        }
      }
    }

    return elInfo;
  }
예제 #10
0
파일: main.c 프로젝트: bmarcot/vega-test
int main()
{
	for (int i = 1; i < 4; i++) {
		test_printf("%d...\n", i);
		msleep(999);
	}
	TEST_EXIT(0);
}
예제 #11
0
  double
  CFE_NormAndErrorFcts::H1Err(
    AbstractFunction<WorldVector<double>, WorldVector<double>>* u,
    DOFVector<double>* uh,
    ElementLevelSet* elLS,
    int domainFlag,
    int relErr,
    int deg,
    Quadrature* q)
  {
    FUNCNAME("CFE_NormAndErrorFcts::H1Err()");

    int dim = elLS->getDim();
    ElementH1Err* elNorm = new ElementH1Err(q, u, uh, relErr, dim);

    TEST_EXIT(dim == Global::getGeo(WORLD))
    ("doesn't work for dimension of problem != dimension of world!\n");

    Flag fillFlag = Mesh::CALL_LEAF_EL |
                    Mesh::FILL_COORDS |
                    Mesh::FILL_DET |
                    Mesh::FILL_GRD_LAMBDA;

    double err = 0.0;
    switch(domainFlag)
    {
    case -3:
      err = Norm_IntNoBound(elNorm, elLS, fillFlag, deg, q);
      break;
    case -2:
      err = Norm_IntBound(elNorm, elLS, fillFlag, deg, q);
      break;
    case -1:
      err = Norm_Int(elNorm, elLS, fillFlag, deg, q);
      break;
    case 0:
      err = Norm_Bound(elNorm, elLS, fillFlag, deg, q);
      break;
    case 1:
      err = Norm_Complete(elNorm, elLS, fillFlag, deg, q);
      break;
    default:
      ERROR_EXIT("illegal flag !\n");
      break;
    }

    H1_err_abs = sqrt(err);
    H1_u_norm = sqrt(elNorm->getNormGrdU());

    if (relErr)
      err = H1_err_abs / (H1_u_norm + 1.e-15);
    else
      err = H1_err_abs;

    delete elNorm;

    return err;
  }
예제 #12
0
  void RosenbrockStationary::addOperator(Operator& op, int row, int col,
                                         double* factor, double* estFactor)
  {
    FUNCNAME("RosenbrockStationary::addOperator()");

    TEST_EXIT(op.getUhOld() == NULL)("UhOld is not allowed to be set!\n");

    op.setUhOld(stageSolution->getDOFVector(col));
    ProblemStat::addVectorOperator(op, row, factor, estFactor);
  }
예제 #13
0
파일: floorf4.c 프로젝트: Mashewnutz/Slo
int main()
{
   TEST_SET_START("20040916145017EJL","EJL", "floorf");
   
   unsigned int i3 = 0x4affffff;  // 2^23 - 0.5, largest truncatable value.           
   unsigned int i3i = 0x4afffffe;                                                      
   unsigned int i4 = 0x4b000000;  // 2^23, no fractional part.                        
   unsigned int i5 = 0xcf000001;  // -2^31, one more large, and negative, value.      

   float x0 = hide_float(0.91825f);
   float x0i = hide_float(0.0f);
   float x1 = hide_float(-0.12958f);
   float x1i = hide_float(-1.0f);
   float x2 = hide_float(-79615.1875f);
   float x2i = hide_float(-79616.0f);
   float x3 = hide_float(make_float(i3));
   float x3i = hide_float(make_float(i3i));
   float x4 = hide_float(make_float(i4));
   float x4i = hide_float(make_float(i4));
   float x5 = hide_float(make_float(i5));
   float x5i = hide_float(make_float(i5));

   vec_float4 x0_v = vec_splat_float(x0);
   vec_float4 x0i_v = vec_splat_float(x0i);
   vec_float4 x1_v = vec_splat_float(x1);
   vec_float4 x1i_v = vec_splat_float(x1i);
   vec_float4 x2_v = vec_splat_float(x2);
   vec_float4 x2i_v = vec_splat_float(x2i);
   vec_float4 x3_v = vec_splat_float(x3);
   vec_float4 x3i_v = vec_splat_float(x3i);
   vec_float4 x4_v = vec_splat_float(x4);
   vec_float4 x4i_v = vec_splat_float(x4i);
   vec_float4 x5_v = vec_splat_float(x5);
   vec_float4 x5i_v = vec_splat_float(x5i);
   
   vec_float4 res_v;

   TEST_START("floorf4");
   res_v = floorf4(x0_v);
   TEST_CHECK("20040916145022EJL", allequal_float4( res_v, x0i_v ), 0);
   res_v = floorf4(x1_v);
   TEST_CHECK("20040916145024EJL", allequal_float4( res_v, x1i_v ), 0);
   res_v = floorf4(x2_v);
   TEST_CHECK("20040916145027EJL", allequal_float4( res_v, x2i_v ), 0);
   res_v = floorf4(x3_v);
   TEST_CHECK("20040916145029EJL", allequal_float4( res_v, x3i_v ), 0);
   res_v = floorf4(x4_v);
   TEST_CHECK("20040916145032EJL", allequal_float4( res_v, x4i_v ), 0);
   res_v = floorf4(x5_v);
   TEST_CHECK("20040916145034EJL", allequal_float4( res_v, x5i_v ), 0);
   
   TEST_SET_DONE();
   
   TEST_EXIT();
}
예제 #14
0
파일: rsqrtf4.c 프로젝트: BlackYoup/medusa
int main()
{
   TEST_SET_START("20040928182349EJL","EJL", "rsqrtf4");

   unsigned int i3 =   0x742c4455;
   unsigned int i3r =  0x251c099a;
   unsigned int i4 =   0x75e7753f; 
   unsigned int i4r =  0x243e5fe2;
   unsigned int i5 =   0x4baa9e3c; 
   unsigned int i5r =  0x395dbbeb;
   unsigned int i6 =   0x39344296; 
   unsigned int i6r =  0x429889eb; 
   unsigned int i7 =   0x68a586b0; 
   unsigned int i7r =  0x2ae11e67;

   float x3 = hide_float(make_float(i3));
   float x3r = hide_float(make_float(i3r));   
   float x4 = hide_float(make_float(i4));     
   float x4r = hide_float(make_float(i4r));   
   float x5 = hide_float(make_float(i5));     
   float x5r = hide_float(make_float(i5r));   
   float x6 = hide_float(make_float(i6));     
   float x6r = hide_float(make_float(i6r));   
   float x7 = hide_float(make_float(i7));
   float x7r = hide_float(make_float(i7r));
   
   vec_float4 x3_v = spu_splats(x3);
   vec_float4 x3r_v = spu_splats(x3r);
   vec_float4 x4_v = spu_splats(x4);
   vec_float4 x4r_v = spu_splats(x4r);
   vec_float4 x5_v = spu_splats(x5);
   vec_float4 x5r_v = spu_splats(x5r);
   vec_float4 x6_v = spu_splats(x6);
   vec_float4 x6r_v = spu_splats(x6r);
   vec_float4 x7_v = spu_splats(x7);
   vec_float4 x7r_v = spu_splats(x7r);
   
   vec_float4 res_v;

   TEST_START("rsqrtf4");
   res_v = rsqrtf4(x3_v);
   TEST_CHECK("20040928182352EJL", allequal_ulps_float4( res_v, x3r_v, 2 ), 0);
   res_v = rsqrtf4(x4_v);
   TEST_CHECK("20040928182355EJL", allequal_ulps_float4( res_v, x4r_v, 2 ), 0);
   res_v = rsqrtf4(x5_v);
   TEST_CHECK("20040928182357EJL", allequal_ulps_float4( res_v, x5r_v, 2 ), 0);
   res_v = rsqrtf4(x6_v);
   TEST_CHECK("20040928182358EJL", allequal_ulps_float4( res_v, x6r_v, 2 ), 0);
   res_v = rsqrtf4(x7_v);
   TEST_CHECK("20040928182401EJL", allequal_ulps_float4( res_v, x7r_v, 2 ), 0);
   
   TEST_SET_DONE();
   
   TEST_EXIT();
}
예제 #15
0
파일: sqrtf4.c 프로젝트: BlackYoup/medusa
int main()
{
   TEST_SET_START("20040928182549EJL","EJL", "sqrtf4");

   unsigned int i3 =   0x742c4455;
   unsigned int i3r =  0x59d20034;
   unsigned int i4 =   0x75e7753f; 
   unsigned int i4r =  0x5aac1fb5;
   unsigned int i5 =   0x4baa9e3c; 
   unsigned int i5r =  0x4593c7d8;
   unsigned int i6 =   0x39344296; 
   unsigned int i6r =  0x3c56d14c; 
   unsigned int i7 =   0x68a586b0; 
   unsigned int i7r =  0x54118f09;

   float x3 = hide_float(make_float(i3));
   float x3r = hide_float(make_float(i3r));   
   float x4 = hide_float(make_float(i4));     
   float x4r = hide_float(make_float(i4r));   
   float x5 = hide_float(make_float(i5));     
   float x5r = hide_float(make_float(i5r));   
   float x6 = hide_float(make_float(i6));     
   float x6r = hide_float(make_float(i6r));   
   float x7 = hide_float(make_float(i7));
   float x7r = hide_float(make_float(i7r));
   
   vec_float4 x3_v = spu_splats(x3);
   vec_float4 x3r_v = spu_splats(x3r);
   vec_float4 x4_v = spu_splats(x4);
   vec_float4 x4r_v = spu_splats(x4r);
   vec_float4 x5_v = spu_splats(x5);
   vec_float4 x5r_v = spu_splats(x5r);
   vec_float4 x6_v = spu_splats(x6);
   vec_float4 x6r_v = spu_splats(x6r);
   vec_float4 x7_v = spu_splats(x7);
   vec_float4 x7r_v = spu_splats(x7r);
   
   vec_float4 res_v;

   TEST_START("sqrtf4");
   res_v = sqrtf4(x3_v);
   TEST_CHECK("20040928182552EJL", allequal_ulps_float4( res_v, x3r_v, 2 ), 0);
   res_v = sqrtf4(x4_v);
   TEST_CHECK("20040928182554EJL", allequal_ulps_float4( res_v, x4r_v, 2 ), 0);
   res_v = sqrtf4(x5_v);
   TEST_CHECK("20040928182556EJL", allequal_ulps_float4( res_v, x5r_v, 2 ), 0);
   res_v = sqrtf4(x6_v);
   TEST_CHECK("20040928182557EJL", allequal_ulps_float4( res_v, x6r_v, 2 ), 0);
   res_v = sqrtf4(x7_v);
   TEST_CHECK("20040928182559EJL", allequal_ulps_float4( res_v, x7r_v, 2 ), 0);
   
   TEST_SET_DONE();
   
   TEST_EXIT();
}
예제 #16
0
int test_crash_runner()
{
    int status;

    switch(test_crash_pid = fork())
    {
    case -1:  /* error */
        TEST_EXIT(1);
    case 0:   /* child */
        test_crash_do();
        return 0;
    default:  /* parent */
        if(waitpid(test_crash_pid, &status, 0) < 0) TEST_EXIT(1);
        if(0 != test_crash_check(status)) TEST_EXIT(1);
        fclose(stdin);
        fclose(stdout);
        fclose(stderr);
        return 0;
    }
}
예제 #17
0
파일: main.c 프로젝트: bmarcot/vega-test
int main(void)
{
	int fd = open("/dev/timer0", 0);
	if (fd < 0) {
		printk("error: failed to open /dev/timer0\n");
		TEST_EXIT(1);
	}

	struct timespec ts = {.tv_sec = 3, .tv_nsec = 0};
	ioctl(fd, CLOCK_SET_TIME, &ts);
	ioctl(fd, CLOCK_START);

	int bytes, n;
	bytes = read(fd, &n, 4);
	if (n != 1)
		TEST_EXIT(1);
	if (bytes != 4)
		TEST_EXIT(1);

	TEST_EXIT(0);
}
예제 #18
0
int test_crash_do()
{
    test_crash_extra_msg_len = strlen(TEST_CRASH_EXTRA_MSG);
    
    /* we need not core dump file */
    struct rlimit rlim = {.rlim_cur = 0, .rlim_max = 0};
    if(setrlimit(RLIMIT_CORE, &rlim)) TEST_EXIT(2);

    if(svx_crash_set_callback(cb, NULL)) TEST_EXIT(2);
    if(svx_crash_set_head_msg(TEST_CRASH_HEAD_MSG)) TEST_EXIT(2);
    if(svx_crash_set_timezone_mode(SVX_CRASH_TIMEZONE_MODE_LOCAL)) TEST_EXIT(2);
    if(svx_crash_set_dirname("./")) TEST_EXIT(2);
    if(svx_crash_set_prefix("test_crash")) TEST_EXIT(2);
    if(svx_crash_set_suffix("log")) TEST_EXIT(2);
    if(svx_crash_set_max_dumps(1)) TEST_EXIT(2);
    if(svx_crash_register_signal_handler()) TEST_EXIT(2);

    fclose(stdin);
    fclose(stdout);

    /* let the gcc's ThreadSanitizer print messages to stderr */
    /* fclose(stderr); */
    
    pthread_setname_np(pthread_self(), "test_thd_name");
    return aa();
}

static int test_crash_filter(const struct dirent *entry)
{
    char buf[1024];
    
    snprintf(buf, sizeof(buf), "test_crash.*.%d.log", test_crash_pid);

    switch(fnmatch(buf , entry->d_name, 0))
    {
    case 0           : return 1;
    case FNM_NOMATCH : return 0;
    default          : TEST_EXIT(1);
    }
}
예제 #19
0
      int readMetaData(string filename,
                       map<int, int>& elInRank,
                       map<int, int>& elCodeSize,
                       string& arhPrefix)
      {
        ifstream file;
        file.open(filename.c_str());
        TEST_EXIT(file.is_open())
        ("Cannot open arh meta file \"%s\"\n", filename.c_str());

        string readStr = "";
        file >> readStr;
        arhPrefix = "";
        file >> arhPrefix;
        int nProc;
        file >> nProc;

        // Maps to each macro element index the arh file index it is stored in.
        for (int i = 0; i < nProc; i++)
        {
          int tmp;
          file >> tmp;
          TEST_EXIT(tmp == i)("Should not happen!\n");
          int nMacroEl;
          file >> nMacroEl;
          for (int j = 0; j < nMacroEl; j++)
          {
            int elIndex, codeSize;
            file >> elIndex;
            file >> codeSize;
            elInRank[elIndex] = i;
            elCodeSize[elIndex] = codeSize;
          }
        }

        file.close();

        return nProc;
      }
예제 #20
0
파일: main.c 프로젝트: bmarcot/vega-test
int main(void)
{
	unsigned long hash;

	struct kmem_cache *cache = KMEM_CACHE(foo);

	if (cache == NULL) {
		printk("error: Cannot create cache\n");
		TEST_EXIT(1);
	}

	hash = page_alloc_signature();

	struct foo *fp[40];
	for (int i = 0; i < 40; i++) {
		fp[i] = kmem_cache_alloc(cache, CACHE_OPT_NONE);
		fp[i]->a = i;
	}

	if (page_alloc_signature() == hash) {
		printk("error: No memory allocated\n");
		TEST_EXIT(1);
	}

	for (int i = 0; i < 40; i++) {
		if (fp[i]->a != i) {
			printk("error: Address allocated multiple times\n");
			TEST_EXIT(1);
		}
		kmem_cache_free(cache, fp[i]);
	}

	if (page_alloc_signature() != hash) {
		printk("error: Memory not correctly restored\n");
		TEST_EXIT(1);
	}

	TEST_EXIT(0);
}
예제 #21
0
  void RosenbrockStationary::addTimeOperator(int row, int col)
  {
    FUNCNAME("RosenbrockStationary::addTimeOperator()");

    TEST_EXIT(invTauGamma)("This should not happen!\n");

    Operator* op = new Operator(componentSpaces[row], componentSpaces[col]);
    op->addZeroOrderTerm(new Simple_ZOT);
    ProblemStat::addMatrixOperator(op, row, col, invTauGamma, invTauGamma);

    Operator* opRhs = new Operator(componentSpaces[row]);
    opRhs->addZeroOrderTerm(new VecAtQP_ZOT(timeRhsVec->getDOFVector(col)));
    ProblemStat::addVectorOperator(opRhs, row);
  }
예제 #22
0
파일: main.c 프로젝트: bmarcot/vega-test
void flash_init(void)
{
	struct dentry dentry = { .d_name  = "mtd1" };

	printk("Creating MTD device %s\n", dentry.d_name);
	if (mtdram_init_device(&mtd1, &_binary_sda1_start, 4096,
				dentry.d_name))
		printk("error: mtdram init device failed\n");
	add_mtd_device(&mtd1, dentry.d_name);
}

int main()
{
	flash_init();
	mount("/dev/mtd1", "/dev/flash", "romfs", 0, 0);

	/* execve does not return in POSIX standard */
	if (execve("/dev/flash/a.out", 0, 0))
		TEST_EXIT(1);
	sched_yield();

	TEST_EXIT(0);
}
int main() {
 TEST_STRT(2);
 TEST_DIAG("This test may fail due to an unavoidable race condition");
 int f = fork();
 if (f < 0) {
   TEST_EXIT("Fork failed");
 } else if (f == 0) {
   TEST_FINI("child"); /* success 1 */
 } else {
   sleep(20);
   TEST_FINI("parent"); /* success 2 */
 }
 exit();
}
예제 #24
0
파일: main.c 프로젝트: bmarcot/vega-test
void flash_init(void)
{
	struct dentry dentry = { .d_name  = "mtd1" };

	printk("Creating MTD device %s\n", dentry.d_name);
	if (mtdram_init_device(&mtd1, &_binary_sda1_start, 1024,
				dentry.d_name))
		printk("error: mtdram init device failed\n");
	add_mtd_device(&mtd1, dentry.d_name);
}

int main()
{
	int fd;
	char buffer[128];

	/* printk("filesystem at %p\n", &_binary_sda1_start); */
	/* dump_romfs_info(&_binary_sda1_start); */

	flash_init();
	mount("/dev/mtd1", "/dev/flash", "romfs", 0, 0);

	/* Lorem ipsum dolor sit amet, consectetur adipiscing elit. */
	fd = open("/dev/flash/lorem.txt", 0);
	if (fd < 0) {
		printk("error: failed to open /home/lorem.txt\n");
		TEST_EXIT(1);
	}

	memset(buffer, 0, 128);
	read(fd, buffer, 11);
	printk("read(): %s\n", buffer);
	if (strcmp(buffer, "Lorem ipsum"))
		TEST_EXIT(1);

	memset(buffer, 0, 128);
	read(fd, buffer, 10);
	printk("read(): %s\n", buffer);
	if (strcmp(buffer, " dolor sit"))
		TEST_EXIT(1);

	memset(buffer, 0, 128);
	read(fd, buffer, 18);
	printk("read(): %s\n", buffer);
	if (strcmp(buffer, " amet, consectetur"))
		TEST_EXIT(1);

	/* rewind the file */
	lseek(fd, 0, SEEK_SET);
	memset(buffer, 0, 128);
	read(fd, buffer, 11);
	printk("read(): %s\n", buffer);
	if (strcmp(buffer, "Lorem ipsum"))
		TEST_EXIT(1);

	TEST_EXIT(0);
}
예제 #25
0
int main()
{
   TEST_SET_START("20060731203500MH","MH", "negatell2");
   
   vec_llong2 x0n_v = spu_splats(0LL);
   vec_llong2 x0p_v = spu_splats(0LL);
   vec_llong2 x1n_v = spu_splats(-83582LL);
   vec_llong2 x1p_v = spu_splats(83582LL);
   vec_llong2 x2n_v = spu_splats(-13152LL);
   vec_llong2 x2p_v = spu_splats(13152LL);
   vec_llong2 x3n_v = spu_splats(-1LL);
   vec_llong2 x3p_v = spu_splats(1LL);
   vec_llong2 x4n_v = spu_splats((long long)0x8000000000000001ULL);
   vec_llong2 x4p_v = spu_splats(0x7fffffffffffffffLL);
   vec_llong2 x5n_v = spu_splats((long long)0x8000000100000000ULL);
   vec_llong2 x5p_v = spu_splats(0x7fffffff00000000LL);
   
   vec_llong2 res_v;

   TEST_START("negatell2");
   res_v = negatell2(x0n_v);
   TEST_CHECK("20060731203501MH", allequal_llong2( res_v, x0p_v ), 0);
   res_v = negatell2(x0p_v);
   TEST_CHECK("20060731203502MH", allequal_llong2( res_v, x0n_v ), 0);
   res_v = negatell2(x1n_v);
   TEST_CHECK("20060731203503MH", allequal_llong2( res_v, x1p_v ), 0);
   res_v = negatell2(x1p_v);
   TEST_CHECK("20060731203504MH", allequal_llong2( res_v, x1n_v ), 0);
   res_v = negatell2(x2n_v);
   TEST_CHECK("20060731203505MH", allequal_llong2( res_v, x2p_v ), 0);
   res_v = negatell2(x2p_v);
   TEST_CHECK("20060731203506MH", allequal_llong2( res_v, x2n_v ), 0);
   res_v = negatell2(x3n_v);
   TEST_CHECK("20060731203507MH", allequal_llong2( res_v, x3p_v ), 0);
   res_v = negatell2(x3p_v);
   TEST_CHECK("20060731203508MH", allequal_llong2( res_v, x3n_v ), 0);
   res_v = negatell2(x4n_v);
   TEST_CHECK("20060731203509MH", allequal_llong2( res_v, x4p_v ), 0);
   res_v = negatell2(x4p_v);
   TEST_CHECK("20060731203510MH", allequal_llong2( res_v, x4n_v ), 0);
   res_v = negatell2(x5n_v);
   TEST_CHECK("20060731203511MH", allequal_llong2( res_v, x5p_v ), 0);
   res_v = negatell2(x5p_v);
   TEST_CHECK("20060731203512MH", allequal_llong2( res_v, x5n_v ), 0);
   
   TEST_SET_DONE();
   
   TEST_EXIT();
}
예제 #26
0
파일: negatef4.c 프로젝트: KTaskn/MMDAgent
int main()
{
    TEST_SET_START("20040930102649EJL","EJL", "negatef4");

    unsigned int i3n = 0xffffffff;
    unsigned int i3p = 0x7fffffff;

    float x0n = hide_float(-0.0f);
    float x0p = hide_float(0.0f);
    float x1n = hide_float(-83532.96153153f);
    float x1p = hide_float(83532.96153153f);
    float x2n = hide_float(-0.0000000013152f);
    float x2p = hide_float(0.0000000013152f);
    float x3n = hide_float(make_float(i3n));
    float x3p = hide_float(make_float(i3p));

    vec_float4 x0n_v = spu_splats(x0n);
    vec_float4 x0p_v = spu_splats(x0p);
    vec_float4 x1n_v = spu_splats(x1n);
    vec_float4 x1p_v = spu_splats(x1p);
    vec_float4 x2n_v = spu_splats(x2n);
    vec_float4 x2p_v = spu_splats(x2p);
    vec_float4 x3n_v = spu_splats(x3n);
    vec_float4 x3p_v = spu_splats(x3p);

    vec_float4 res_v;

    TEST_START("negatef4");
    res_v = negatef4(x0n_v);
    TEST_CHECK("20040930102652EJL", allequal_float4( res_v, x0p_v ), 0);
    res_v = negatef4(x0p_v);
    TEST_CHECK("20040930102653EJL", allequal_float4( res_v, x0n_v ), 0);
    res_v = negatef4(x1n_v);
    TEST_CHECK("20040930102655EJL", allequal_float4( res_v, x1p_v ), 0);
    res_v = negatef4(x1p_v);
    TEST_CHECK("20040930102657EJL", allequal_float4( res_v, x1n_v ), 0);
    res_v = negatef4(x2n_v);
    TEST_CHECK("20040930102659EJL", allequal_float4( res_v, x2p_v ), 0);
    res_v = negatef4(x2p_v);
    TEST_CHECK("20040930102701EJL", allequal_float4( res_v, x2n_v ), 0);
    res_v = negatef4(x3n_v);
    TEST_CHECK("20040930102703EJL", allequal_float4( res_v, x3p_v ), 0);
    res_v = negatef4(x3p_v);
    TEST_CHECK("20040930102705EJL", allequal_float4( res_v, x3n_v ), 0);

    TEST_SET_DONE();

    TEST_EXIT();
}
예제 #27
0
파일: main.c 프로젝트: bmarcot/vega-test
int main(void)
{
	printk ("Starting consumer/producer example...\n");

	pthread_cond_init(&condvar, NULL);

	// create the producer and consumer threads
	pthread_create (NULL, NULL, producer, NULL);
	pthread_create (NULL, NULL, consumer, NULL);

	while (count < 5)
		pthread_yield();
	printk ("Bye-bye!\n");

	TEST_EXIT(0);
}
예제 #28
0
  double
  CFE_NormAndErrorFcts::H1NormSquare_Analyt(
    AbstractFunction<WorldVector<double>, WorldVector<double>>* grd,
    ElementLevelSet* elLS,
    int domainFlag,
    int deg,
    Quadrature* q)
  {
    FUNCNAME("CFE_NormAndErrorFcts::H1NormSquare_Analyt");

    int dim = elLS->getDim();
    ElementH1Norm_Analyt* elNorm = new ElementH1Norm_Analyt(q, grd, dim);

    TEST_EXIT(dim == Global::getGeo(WORLD))
    ("doesn't work for dimension of problem != dimension of world!\n");

    Flag fillFlag = Mesh::CALL_LEAF_EL |
                    Mesh::FILL_COORDS |
                    Mesh::FILL_DET;

    double nrm = 0.0;
    switch(domainFlag)
    {
    case -3:
      nrm = Norm_IntNoBound(elNorm, elLS, fillFlag, deg, q);
      break;
    case -2:
      nrm = Norm_IntBound(elNorm, elLS, fillFlag, deg, q);
      break;
    case -1:
      nrm = Norm_Int(elNorm, elLS, fillFlag, deg, q);
      break;
    case 0:
      nrm = Norm_Bound(elNorm, elLS, fillFlag, deg, q);
      break;
    case 1:
      nrm = Norm_Complete(elNorm, elLS, fillFlag, deg, q);
      break;
    default:
      ERROR_EXIT("illegal flag !\n");
      break;
    }

    delete elNorm;

    return nrm;
  }
예제 #29
0
    Serializer(ProblemType* prob, std::string filename, int writeEveryIth)
      : name(filename),
        problem(prob),
        tsModulo(writeEveryIth),
        appendIndex(0),
        indexLength(5),
        indexDecimals(3),
        timestepNumber(-1)
    {
      FUNCNAME("Serializer::Serializer()");

      TEST_EXIT(name != "")("No filename!\n");

      Parameters::get(problem->getName() + "->output->append serialization index", appendIndex);
      Parameters::get(problem->getName() + "->output->index length", indexLength);
      Parameters::get(problem->getName() + "->output->index decimals", indexDecimals);
    }
예제 #30
0
      int readMetaData(string filename)
      {
        FUNCNAME("ArhReader::readMetaData()");

        ifstream file;
        file.open(filename.c_str());
        TEST_EXIT(file.is_open())
        ("Cannot open arh meta file \"%s\"\n", filename.c_str());

        string readStr = "";
        file >> readStr;
        file >> readStr;
        int nProc;
        file >> nProc;
        file.close();
        return nProc;
      }