本文整理汇总了C++中UNTESTED函数的典型用法代码示例。如果您正苦于以下问题:C++ UNTESTED函数的具体用法?C++ UNTESTED怎么用?C++ UNTESTED使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UNTESTED函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
/****
* Main function
*/
int main(int argc, char * argv[])
{
long opt_TMR, opt_CS;
int ret=0;
output_init();
#if VERBOSE > 1
output("Test starting...\n");
#endif
opt_TMR=sysconf(_SC_TIMERS);
opt_CS =sysconf(_SC_CLOCK_SELECTION);
#if VERBOSE > 1
output("Timers option : %li\n", opt_TMR);
output("Clock Selection option : %li\n", opt_CS);
#endif
if ((opt_TMR != -1L) && (opt_CS != -1L))
{
#if VERBOSE > 0
output("Starting clock test\n");
#endif
ret = do_cs_test();
}
else
{
UNTESTED("This test requires unsupported features");
}
if (ret != 0)
{ FAILED("The cond vars use different clocks."); }
PASSED;
}
示例2: main
/* main function */
int main()
{
int ret;
long rts;
struct sigaction sa;
/* Initialize output */
output_init();
/* Test the RTS extension */
rts = sysconf(_SC_REALTIME_SIGNALS);
if (rts < 0L) {
UNTESTED("This test needs the RTS extension");
}
/* Set the signal handler */
sa.sa_flags = SA_SIGINFO;
sa.sa_sigaction = handler;
ret = sigemptyset(&sa.sa_mask);
if (ret != 0) {
UNRESOLVED(ret, "Failed to empty signal set");
}
/* Install the signal handler for SIGTERM */
ret = sigaction(SIGNAL, &sa, 0);
if (ret != 0) {
UNRESOLVED(ret, "Failed to set signal handler");
}
if (called) {
FAILED
("The signal handler has been called when no signal was raised");
}
ret = raise(SIGNAL);
if (ret != 0) {
UNRESOLVED(ret, "Failed to raise SIGTERM");
}
if (!called) {
FAILED
("the sa_handler was not called whereas SA_SIGINFO was not set");
}
/* Test passed */
#if VERBOSE > 0
output("Test passed\n");
#endif
PASSED;
}
示例3: sched_get_priority_min
/* thread function 2 */
void *changer(void *arg)
{
int ret = 0;
struct sched_param sp;
sp.sched_priority = sched_get_priority_min(SCHED_RR);
if (sp.sched_priority < 0) {
UNTESTED("Failed to get min SCHED_RR range");
}
/* set the other thread's policy */
ret = pthread_setschedparam(*(pthread_t *) arg, SCHED_RR, &sp);
if (ret != 0) {
UNRESOLVED(ret, "Failed to set other's thread policy");
}
return NULL;
}
示例4: pthread_cond_destroy
/* Destroy data */
ret = pthread_cond_destroy(&(data.cnd));
if (ret != 0)
UNRESOLVED(ret, "Cond destroy failed");
ret = pthread_mutex_destroy(&(data.mtx1));
if (ret != 0)
UNRESOLVED(ret, "Mutex 1 destroy failed");
ret = pthread_mutex_destroy(&(data.mtx2));
if (ret != 0)
UNRESOLVED(ret, "Mutex 2 destroy failed");
ret = pthread_condattr_destroy(&ca);
if (ret != 0)
UNRESOLVED(ret, "Cond attribute destroy failed");
ret = pthread_mutexattr_destroy(&ma);
if (ret != 0)
UNRESOLVED(ret, "Mutex attr destroy failed");
} /* Proceed to next case */
PASSED;
}
#else /* WITHOUT_XOPEN */
int main(int argc, char *argv[])
{
output_init();
UNTESTED("This test requires XSI features");
}
示例5: present
static inline HRESULT
present( struct NineSwapChain9 *This,
const RECT *pSourceRect,
const RECT *pDestRect,
HWND hDestWindowOverride,
const RGNDATA *pDirtyRegion,
DWORD dwFlags )
{
struct pipe_context *pipe;
struct pipe_resource *resource;
struct pipe_fence_handle *fence;
HRESULT hr;
struct pipe_blit_info blit;
DBG("present: This=%p pSourceRect=%p pDestRect=%p "
"pDirtyRegion=%p hDestWindowOverride=%p"
"dwFlags=%d resource=%p\n",
This, pSourceRect, pDestRect, pDirtyRegion,
hDestWindowOverride, (int)dwFlags, This->buffers[0]->base.resource);
if (pSourceRect)
DBG("pSourceRect = (%u..%u)x(%u..%u)\n",
pSourceRect->left, pSourceRect->right,
pSourceRect->top, pSourceRect->bottom);
if (pDestRect)
DBG("pDestRect = (%u..%u)x(%u..%u)\n",
pDestRect->left, pDestRect->right,
pDestRect->top, pDestRect->bottom);
/* TODO: in the case the source and destination rect have different size:
* We need to allocate a new buffer, and do a blit to it to resize.
* We can't use the present_buffer for that since when we created it,
* we couldn't guess which size would have been needed.
* If pDestRect or pSourceRect is null, we have to check the sizes
* from the source size, and the destination window size.
* In this case, either resize rngdata, or pass NULL instead
*/
/* Note: This->buffers[0]->level should always be 0 */
if (This->rendering_done)
goto bypass_rendering;
resource = This->buffers[0]->base.resource;
if (This->params.SwapEffect == D3DSWAPEFFECT_DISCARD)
handle_draw_cursor_and_hud(This, resource);
pipe = NineDevice9_GetPipe(This->base.device);
if (This->present_buffers[0]) {
memset(&blit, 0, sizeof(blit));
blit.src.resource = resource;
blit.src.level = 0;
blit.src.format = resource->format;
blit.src.box.z = 0;
blit.src.box.depth = 1;
blit.src.box.x = 0;
blit.src.box.y = 0;
blit.src.box.width = resource->width0;
blit.src.box.height = resource->height0;
resource = This->present_buffers[0];
blit.dst.resource = resource;
blit.dst.level = 0;
blit.dst.format = resource->format;
blit.dst.box.z = 0;
blit.dst.box.depth = 1;
blit.dst.box.x = 0;
blit.dst.box.y = 0;
blit.dst.box.width = resource->width0;
blit.dst.box.height = resource->height0;
blit.mask = PIPE_MASK_RGBA;
blit.filter = PIPE_TEX_FILTER_NEAREST;
blit.scissor_enable = FALSE;
blit.alpha_blend = FALSE;
pipe->blit(pipe, &blit);
}
/* The resource we present has to resolve fast clears
* if needed (and other things) */
pipe->flush_resource(pipe, resource);
if (This->params.SwapEffect != D3DSWAPEFFECT_DISCARD)
handle_draw_cursor_and_hud(This, resource);
fence = NULL;
pipe->flush(pipe, &fence, PIPE_FLUSH_END_OF_FRAME);
if (fence) {
swap_fences_push_back(This, fence);
This->screen->fence_reference(This->screen, &fence, NULL);
}
This->rendering_done = TRUE;
bypass_rendering:
if (dwFlags & D3DPRESENT_DONOTWAIT) {
UNTESTED(2);
//.........这里部分代码省略.........
示例6: do_cs_test
int do_cs_test(void)
{
int ret;
int result=0;
pthread_mutex_t mtxN, mtxI;
pthread_cond_t cndN;
pthread_condattr_t ca;
pthread_t thN, thD;
struct timespec ts, timeout;
clockid_t cid;
/* The 3 next data aim to minimize the impact on the
* system time, when the monotonic clock is supported
*/
long monotonic_clk;
struct timespec diff;
char sens=0;
/* We are going to initialize the cond vars and the mutexes */
dtN.pmtx = &mtxN;
dtI.pmtx = &mtxI;
dtN.pcnd = &cndN;
dtI.pcnd = &cndI;
ret = pthread_mutex_init(&mtxI, NULL);
if (ret != 0)
{ UNRESOLVED(ret, "Unable to initialize a default mutex"); }
ret = pthread_mutex_init(&mtxN, NULL);
if (ret != 0)
{ UNRESOLVED(ret, "Unable to initialize a default mutex"); }
ret = pthread_condattr_init(&ca);
if (ret != 0)
{ UNRESOLVED(ret, "Unable to initialize cond attribute object"); }
#if 0 /* Test if the testcase is valid: change the clock from the "NULL" cond var */
pthread_condattr_setclock(&ca, CLOCK_MONOTONIC);
ret = pthread_cond_init(&cndN, &ca);
pthread_condattr_setclock(&ca, CLOCK_REALTIME);
#else
ret = pthread_cond_init(&cndN, NULL);
#endif
if (ret != 0)
{ UNRESOLVED(ret, "Unable to initialize the NULL attribute conditional variable."); }
dtI.ctrl = 0;
dtN.ctrl = 0;
dtI.rc = 0;
dtN.rc = 0;
#if VERBOSE > 1
output("Data initialized successfully for CS test.\n");
#endif
monotonic_clk = sysconf(_SC_MONOTONIC_CLOCK);
#if VERBOSE > 1
output("Sysconf for monotonix clock: %li\n", monotonic_clk);
#endif
/* Get the default clock ID */
ret = pthread_condattr_getclock(&ca, &cid);
if (ret != 0)
{ UNRESOLVED(ret, "Unable to get clockid from the default cond attribute object"); }
/* Check whether we can set the system clock */
/* Backup the current monotonic time if available */
if (monotonic_clk != -1L)
{
ret = clock_gettime(CLOCK_MONOTONIC, &diff);
if (ret != 0)
{
output("Clock_gettime(CLOCK_MONOTONIC) failed when the system claims to support this option\n");
monotonic_clk = -1L;
}
}
ret = clock_gettime(cid, &ts);
if (ret != 0)
{ UNRESOLVED(errno, "Unable to get clock time"); }
ret = clock_settime(cid, &ts);
if (ret != 0)
{
#if VERBOSE > 1
output("clock_settime failed (%s)\n", strerror(errno));
output("We cannot test if both cond uses the same clock then...\n");
#endif
UNTESTED("Was unable to set the default clock time. Need more privileges?");
}
else /* We can do the test */
{
#if VERBOSE > 1
output("clock_settime succeeded\n");
#endif
if (monotonic_clk != -1L)
//.........这里部分代码省略.........
示例7: main
int main(void)
{
int ret, status;
pid_t child, ctl;
long ctp, ctt;
clockid_t clp, clt;
struct timespec tp;
output_init();
ctp = sysconf(_SC_CPUTIME);
ctt = sysconf(_SC_THREAD_CPUTIME);
if ((ctp == -1) && (ctt == -1)) {
UNTESTED
("The testcase needs CPUTIME or THREAD_CPUTIME support");
}
#if VERBOSE > 0
output("System abilities:\n");
output(" _POSIX_CPUTIME : %ld\n", ctp);
output(" _POSIX_THREAD_CPUTIME : %ld\n", ctt);
#endif
if (ctp > 0) {
ret = clock_getcpuclockid(0, &clp);
if (ret != 0) {
UNRESOLVED(ret,
"Unable to get cpu-time clock id of the process");
}
do {
ret = clock_gettime(clp, &tp);
if (ret != 0) {
UNRESOLVED(errno,
"Failed to read CPU time clock");
}
}
while (tp.tv_sec < 1);
}
if (ctt > 0) {
ret = pthread_getcpuclockid(pthread_self(), &clt);
if (ret != 0) {
UNRESOLVED(ret,
"Unable to get cpu-time clock id of the thread");
}
do {
ret = clock_gettime(clt, &tp);
if (ret != 0) {
UNRESOLVED(errno,
"Failed to read thread CPU time clock");
}
}
while (tp.tv_sec < 1);
}
/* Create the child */
child = fork();
if (child == -1) {
UNRESOLVED(errno, "Failed to fork");
}
/* child */
if (child == 0) {
if (ctp > 0) {
ret = clock_getcpuclockid(0, &clp);
if (ret != 0) {
UNRESOLVED(ret,
"Unable to get cpu-time clock id of the process");
}
ret = clock_gettime(clp, &tp);
if (ret != 0) {
UNRESOLVED(errno,
"Failed to read CPU time clock");
}
if (tp.tv_sec > 0) {
FAILED
("The process CPU-time clock was not reset in child\n");
}
}
if (ctt > 0) {
ret = pthread_getcpuclockid(pthread_self(), &clt);
if (ret != 0) {
UNRESOLVED(ret,
//.........这里部分代码省略.........
示例8: pthread_cond_destroy
/* Destroy data */
ret = pthread_cond_destroy(&(data.cnd));
if (ret != 0)
UNRESOLVED(ret, "Cond destroy failed");
ret = pthread_mutex_destroy(&(data.mtx1));
if (ret != 0)
UNRESOLVED(ret, "Mutex 1 destroy failed");
ret = pthread_mutex_destroy(&(data.mtx2));
if (ret != 0)
UNRESOLVED(ret, "Mutex 2 destroy failed");
ret = pthread_condattr_destroy(&ca);
if (ret != 0)
UNRESOLVED(ret, "Cond attribute destroy failed");
ret = pthread_mutexattr_destroy(&ma);
if (ret != 0)
UNRESOLVED(ret, "Mutex attr destroy failed");
} /* Proceed to next case */
PASSED;
}
#else /* WITHOUT_XOPEN */
int main(void)
{
output_init();
UNTESTED("This test requires XSI features");
}
示例9: main
/* The main test function. */
int main(void)
{
int ret, i;
sem_t *sems;
sem_t sem_last;
long max;
/* Initialize output */
output_init();
max = sysconf(_SC_SEM_NSEMS_MAX);
if (max <= 0) {
output("sysconf(_SC_SEM_NSEMS_MAX) = %ld\n", max);
UNTESTED("There is no constraint on SEM_NSEMS_MAX");
}
sems = (sem_t *) calloc(max, sizeof(sem_t));
if (sems == NULL) {
UNRESOLVED(errno, "Failed to alloc space");
}
for (i = 0; i < max; i++) {
ret = sem_init(&sems[i], 0, 0);
if (ret != 0) {
output
("sem_init failed to initialize the %d nth semaphore.\n",
i);
output("Tryed to initialize %ld.\n", max);
output("Error is %d: %s\n", errno, strerror(errno));
for (; i > 0; i--)
sem_destroy(&sems[i - 1]);
free(sems);
PASSED;
}
}
ret = sem_init(&sem_last, 0, 1);
if (ret == 0) {
FAILED
("We were able to sem_init more than SEM_NSEMS_MAX semaphores");
}
if (errno != ENOSPC) {
output("Error is %d: %s\n", errno, strerror(errno));
}
for (i = 0; i < max; i++)
sem_destroy(&sems[i]);
free(sems);
/* Test passed */
#if VERBOSE > 0
output("Test passed\n");
#endif
PASSED;
}
示例10: scenar_init
/* This function will initialize every pthread_attr_t object in the scenarii array */
void scenar_init()
{
int ret=0;
int i;
int old;
long pagesize, minstacksize;
long tsa, tss, tps;
pagesize =sysconf(_SC_PAGESIZE);
minstacksize =sysconf(_SC_THREAD_STACK_MIN);
tsa =sysconf(_SC_THREAD_ATTR_STACKADDR);
tss =sysconf(_SC_THREAD_ATTR_STACKSIZE);
tps =sysconf(_SC_THREAD_PRIORITY_SCHEDULING);
#if VERBOSE > 0
output("System abilities:\n");
output(" TSA: %li\n", tsa);
output(" TSS: %li\n", tss);
output(" TPS: %li\n", tps);
output(" pagesize: %li\n", pagesize);
output(" min stack size: %li\n", minstacksize);
#endif
if (minstacksize % pagesize)
{
UNTESTED("The min stack size is not a multiple of the page size");
}
for (i=0; i<NSCENAR; i++)
{
#if VERBOSE > 2
output("Initializing attribute for scenario %i: %s\n", i, scenarii[i].descr);
#endif
ret = pthread_attr_init(&scenarii[i].ta);
if (ret != 0) { UNRESOLVED(ret, "Failed to initialize a thread attribute object"); }
/* Set the attributes according to the scenario */
if (scenarii[i].detached == 1)
{
ret = pthread_attr_setdetachstate(&scenarii[i].ta, PTHREAD_CREATE_DETACHED);
if (ret != 0) { UNRESOLVED(ret, "Unable to set detachstate"); }
}
else
{
ret = pthread_attr_getdetachstate(&scenarii[i].ta, &old);
if (ret != 0) { UNRESOLVED(ret, "Unable to get detachstate from initialized attribute"); }
if (old != PTHREAD_CREATE_JOINABLE) { FAILED("The default attribute is not PTHREAD_CREATE_JOINABLE"); }
}
#if VERBOSE > 4
output("Detach state was set sucessfully\n");
#endif
/* Sched related attributes */
if (tps>0) /* This routine is dependent on the Thread Execution Scheduling option */
{
if (scenarii[i].explicitsched == 1)
ret = pthread_attr_setinheritsched(&scenarii[i].ta, PTHREAD_EXPLICIT_SCHED);
else
ret = pthread_attr_setinheritsched(&scenarii[i].ta, PTHREAD_INHERIT_SCHED);
if (ret != 0) { UNRESOLVED(ret, "Unable to set inheritsched attribute"); }
#if VERBOSE > 4
output("inheritsched state was set sucessfully\n");
#endif
}
#if VERBOSE > 4
else
output("TPS unsupported => inheritsched parameter untouched\n");
#endif
if (tps>0) /* This routine is dependent on the Thread Execution Scheduling option */
{
if (scenarii[i].schedpolicy == 1)
{
ret = pthread_attr_setschedpolicy(&scenarii[i].ta, SCHED_FIFO);
}
if (scenarii[i].schedpolicy == 2)
{
ret = pthread_attr_setschedpolicy(&scenarii[i].ta, SCHED_RR);
}
if (ret != 0) { UNRESOLVED(ret, "Unable to set the sched policy"); }
#if VERBOSE > 4
if (scenarii[i].schedpolicy)
output("Sched policy was set sucessfully\n");
else
output("Sched policy untouched\n");
#endif
}
#if VERBOSE > 4
else
output("TPS unsupported => sched policy parameter untouched\n");
#endif
if (scenarii[i].schedparam != 0)
{
struct sched_param sp;
ret = pthread_attr_getschedpolicy(&scenarii[i].ta, &old);
//.........这里部分代码省略.........
示例11: main
/* main function */
int main()
{
int ret;
long rts;
struct sigaction sa;
union sigval sv;
sigset_t mask;
/* Initialize output */
output_init();
/* Test the RTS extension */
rts = sysconf(_SC_REALTIME_SIGNALS);
if (rts < 0L)
{
UNTESTED("This test needs the RTS extension");
}
/* Set the signal handler */
sa.sa_flags = SA_SIGINFO;
sa.sa_sigaction = handler;
ret = sigemptyset(&sa.sa_mask);
if (ret != 0)
{
UNRESOLVED(ret, "Failed to empty signal set");
}
/* Install the signal handler for SIGRTMAX */
ret = sigaction(SIGRTMAX, &sa, 0);
if (ret != 0)
{
UNRESOLVED(ret, "Failed to set signal handler");
}
/* Mask this signal */
ret = sigemptyset(&mask);
if (ret != 0)
{
UNRESOLVED(ret, "An error occured while initializing mask");
}
ret = sigaddset(&mask, SIGRTMAX);
if (ret != 0)
{
UNRESOLVED(ret, "Failed to add SIGRTMAX to signal set");
}
ret = sigprocmask(SIG_BLOCK, &mask, NULL);
if (ret != 0)
{
UNRESOLVED(ret, "Failed to set process signal mask");
}
/* Now queue the signal to be pending */
for (sv.sival_int = 1; sv.sival_int <= QUEUELENGTH; sv.sival_int++)
{
ret = sigqueue(getpid(), SIGRTMAX, sv);
if (ret != 0)
{
UNRESOLVED(ret, "Failed to queue the signal");
}
}
if (latest != 0)
{
FAILED("Signal was delivered while masked??");
}
/* And finally unmask the signal so it is delivered */
ret = sigprocmask(SIG_UNBLOCK, &mask, NULL);
if (ret != 0)
{
UNRESOLVED(ret, "Failed to set process signal mask");
}
sched_yield();
/* Check the signal has been delivered as expected */
if (latest != QUEUELENGTH)
{
output("Only %d signal delivered instead of %d\n", latest, QUEUELENGTH);
if (latest == 1)
{
UNTESTED("It seems like SIGRTMAX is not a queuable signal here?");
}
//.........这里部分代码省略.........
示例12: main
/* The main test function. */
int main( int argc, char * argv[] )
{
#if __APPLE__
return 0;
#else /* !__APPLE__ */
int ret, i;
sem_t *sems;
sem_t sem_last;
long max;
/* Initialize output */
output_init();
max = sysconf( _SC_SEM_NSEMS_MAX );
if ( max <= 0 )
{
#if !__ANDROID__
PASSED;
#else
output( "sysconf( _SC_SEM_NSEMS_MAX ) = %ld\n", max );
UNTESTED( "There is no constraint on SEM_NSEMS_MAX" );
#endif
}
sems = ( sem_t * ) calloc( max, sizeof( sem_t ) );
if ( sems == NULL )
{
UNRESOLVED( errno, "Failed to alloc space" );
}
for ( i = 0; i < max; i++ )
{
ret = sem_init( &sems[ i ], 0, 0 );
if ( ret != 0 )
{
output( "sem_init failed to initialize the %d nth semaphore.\n", i );
output( "Tryed to initialize %ld.\n", max );
output( "Error is %d: %s\n", errno, strerror( errno ) );
for ( ; i > 0; i-- )
sem_destroy( &sems[ i - 1 ] );
free( sems );
PASSED;
}
}
ret = sem_init( &sem_last, 0, 1 );
#if !__ANDROID__
/* Temporarily disable it for Android until https://tracker.crystax.net/issues/1138 is fixed */
if ( ret == 0 )
{
FAILED( "We were able to sem_init more than SEM_NSEMS_MAX semaphores" );
}
if ( errno != ENOSPC )
{
output( "Error is %d: %s\n", errno, strerror( errno ) );
}
#endif /* !__ANDROID__ */
for ( i = 0; i < max; i++ )
sem_destroy( &sems[ i ] );
free( sems );
/* Test passed */
#if VERBOSE > 0
output( "Test passed\n" );
#endif
PASSED;
#endif /* !__APPLE__ */
}
示例13: main
/* The main test function. */
int main(int argc, char * argv[])
{
int ret, i, sig;
long rts;
sigset_t set;
/* Initialize output */
output_init();
/* Test the RTS extension */
rts = sysconf(_SC_REALTIME_SIGNALS);
if (rts < 0L)
{
UNTESTED("This test needs the RTS extension");
}
/* Set the signal mask */
ret = sigemptyset(&set);
if (ret != 0)
{
UNRESOLVED(ret, "Failed to empty signal set");
}
/* Add all SIGRT signals */
for (i = SIGRTMIN; i <= SIGRTMAX; i++)
{
ret = sigaddset(&set, i);
if (ret != 0)
{
UNRESOLVED(ret, "failed to add signal to signal set");
}
}
/* Block all RT signals */
ret = pthread_sigmask(SIG_BLOCK, &set, NULL);
if (ret != 0)
{
UNRESOLVED(ret, "Failed to block RT signals");
}
/* raise the signals in no particular order */
for (i = SIGRTMIN + 1; i <= SIGRTMAX; i += 3)
{
ret = raise(i);
if (ret != 0)
{
UNRESOLVED(ret, "Failed to raise the signal");
}
}
for (i = SIGRTMIN; i <= SIGRTMAX; i += 3)
{
ret = raise(i);
if (ret != 0)
{
UNRESOLVED(ret, "Failed to raise the signal");
}
}
for (i = SIGRTMIN + 2; i <= SIGRTMAX; i += 3)
{
ret = raise(i);
if (ret != 0)
{
UNRESOLVED(ret, "Failed to raise the signal");
}
}
/* All RT signals are pending */
/* Check the signals are delivered in order */
for (i = SIGRTMIN; i <= SIGRTMAX; i++)
{
ret = sigwait(&set, &sig);
if (ret != 0)
{
UNRESOLVED(ret , "Failed to sigwait for RT signal");
}
if (sig != i)
{
output("SIGRTMIN: %d, SIGRTMAX: %d, i: %d, sig:%d\n",
SIGRTMIN, SIGRTMAX, i, sig);
FAILED("Got wrong signal");
}
}
/* Test passed */
#if VERBOSE > 0
output("Test passed\n");
//.........这里部分代码省略.........