本文整理汇总了C++中runtest函数的典型用法代码示例。如果您正苦于以下问题:C++ runtest函数的具体用法?C++ runtest怎么用?C++ runtest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了runtest函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main (int argc, char *argv[])
{
char *fn;
unsigned int verfd = 0;
fn = getenv("TEST_TESTNET3_VERF");
if (fn) {
verfd++;
runtest(true, fn);
}
fn = getenv("TEST_MAINNET_VERF");
if (fn) {
verfd++;
runtest(false, fn);
}
if (!verfd) {
fprintf(stderr,
"chain-verf: Skipping lengthy, extended chain verification test.\n"
"chain-verf: Set TEST_TESTNET3_VERF and/or TEST_MAINNET_VERF to a\n"
"chain-verf: valid pynode blocks.dat file, to enable.\n"
"chain-verf: (a linear sequence of P2P \"block\" messages)\n"
);
return 77;
}
return 0;
}
示例2: cowMng2
void
cowMng2(size_t length)
{
int fd = open(fileName, O_RDWR);
char* shared = (char*)mmap(NULL, length, PROT_READ|PROT_WRITE,
MAP_SHARED, fd, 0);
char* priv = (char*)mmap(NULL, length, PROT_READ|PROT_WRITE,
MAP_PRIVATE, fd, 0);
if (~0UL == (unsigned long)shared) {
printf("Error: %d %s\n", errno, strerror(errno));
}
if (~0UL == (unsigned long)priv) {
printf("Error: %d %s\n", errno, strerror(errno));
}
double result1 = runtest(priv, length, 1);
double result2 = runtest(shared, length, 1);
munmap(priv, length);
munmap(shared, length);
printf("0x%4lx shared: %6.2lfus private: %6.2lfus\n",
length/PAGE_SIZE, result2, result1);
close(fd);
}
示例3: hpteEntry
void
hpteEntry(size_t length)
{
char* start = (char*)mmap(NULL, length, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
if (~0UL == (unsigned long)start) {
printf("Error: %d %s\n", errno, strerror(errno));
}
double result1 = runtest(start, length, 1);
int ret = mflush((unsigned long)start, ((unsigned long)start) + length);
if (ret < 0) {
if (errno==ENOSYS)
return;
printf("mflush error: %d %s\n", errno, strerror(errno));
}
double result2 = runtest(start, length, 1);
munmap(start, length);
printf("0x%4lx hpteEntry write: %.2lfus %.2lfus\n",
length/PAGE_SIZE, result1, result2);
}
示例4: forkFault
void
forkFault(size_t length)
{
char* start = (char*)mmap(NULL, length, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
if (~0UL == (unsigned long)start) {
printf("Error: %d %s\n", errno, strerror(errno));
}
double result1 = runtest(start, length, 1);
double result2;
int pipes[2];
pipe(pipes);
pid_t pid = fork();
if (pid==0) {
result2 = runtest(start, length, 1);
write(pipes[1], &result2, sizeof(result2));
exit(0);
} else {
read(pipes[0], &result2, sizeof(result2));
wait(NULL);
}
double result3 = runtest(start, length, 1);
munmap(start, length);
printf("0x%4lx fork: pre: %.2lfus child: %.2lfus parent: %.2lfus\n",
length/PAGE_SIZE, result1, result2, result3);
}
示例5: test_numbers
void test_numbers()
{
runtest("12345T",0x23450001);
runtest("F.1234T",0xF1234);
runtest("123456789ABCDT",0xABCD6789);
runtest("1234.56789AT",0x9A345678);
runtest("1.15.25+T",0x13A00);
}
示例6: main
int main (int argc, char *argv[])
{
runtest("data/blk0.json", "data/blk0.ser");
runtest("data/blk120383.json", "data/blk120383.ser");
bp_key_static_shutdown();
return 0;
}
示例7: main
int main (int argc, char *argv[])
{
runtest(true, "tx_valid.json");
runtest(false, "tx_invalid.json");
bp_key_static_shutdown();
return 0;
}
示例8: main
int main(int argc, char **argv)
{
int i, srclen, dstlen, ifreq;
double factor;
printf("\n*** Vary source block size*** \n\n");
srclen = 10000;
ifreq = 100;
for(i=0; i<20; i++) {
factor = ((rand() % 16) + 1) / 4.0;
dstlen = (int)(srclen * factor + 10);
runtest(srclen, (double)ifreq, factor, 64, dstlen);
runtest(srclen, (double)ifreq, factor, 32, dstlen);
runtest(srclen, (double)ifreq, factor, 8, dstlen);
runtest(srclen, (double)ifreq, factor, 2, dstlen);
runtest(srclen, (double)ifreq, factor, srclen, dstlen);
}
printf("\n*** Vary dest block size ***\n\n");
srclen = 10000;
ifreq = 100;
for(i=0; i<20; i++) {
factor = ((rand() % 16) + 1) / 4.0;
runtest(srclen, (double)ifreq, factor, srclen, 32);
dstlen = (int)(srclen * factor + 10);
runtest(srclen, (double)ifreq, factor, srclen, dstlen);
}
printf("\n*** Resample factor 1.0, testing different srclen ***\n\n");
ifreq = 40;
for(i=0; i<100; i++) {
srclen = (rand() % 30000) + 10;
dstlen = (int)(srclen + 10);
runtest(srclen, (double)ifreq, 1.0, srclen, dstlen);
}
printf("\n*** Resample factor 1.0, testing different sin freq ***\n\n");
srclen = 10000;
for(i=0; i<100; i++) {
ifreq = ((int)rand() % 10000) + 1;
dstlen = (int)(srclen * 10);
runtest(srclen, (double)ifreq, 1.0, srclen, dstlen);
}
printf("\n*** Resample with different factors ***\n\n");
srclen = 10000;
ifreq = 100;
for(i=0; i<100; i++) {
factor = ((rand() % 64) + 1) / 4.0;
dstlen = (int)(srclen * factor + 10);
runtest(srclen, (double)ifreq, factor, srclen, dstlen);
}
return 0;
}
示例9: main
int main(int argc, char **argv)
{
SaHpiSessionIdT sid = 0;
SaHpiRptEntryT res;
SaHpiRdrT rdr;
SaHpiEntryIdT id = SAHPI_FIRST_ENTRY;
SaHpiResourceIdT resid;
int failcount = 0;
int testnum = 0;
SaErrorT rc = SA_OK;
rc = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sid, NULL);
if(rc != SA_OK) {
failed("Failed to open session");
}
rc = saHpiDiscover(sid);
if(rc != SA_OK) {
failed("Failed to run discover");
}
rc = saHpiRptEntryGet(sid, id, &id, &res);
runtest();
if(rc != SA_OK) {
dbg("Error %s",oh_lookup_error(rc));
failed("Couldn't get the first rpt entry");
/* we're toast, bail */
goto end;
}
else{
id = SAHPI_FIRST_ENTRY;
resid = res.ResourceId;
rc = saHpiRdrGet(sid, resid, id, &id, &rdr);
if (oh_cmp_ep(&rdr.Entity,&res.ResourceEntity) != SAHPI_TRUE){
dbg("Error %s", oh_lookup_error(rc));
failed("Entity path of rdr did not match entity path of resource");
}
runtest();
if(rc != SA_OK){
dbg("Error %s", oh_lookup_error(rc));
failed("Couldn't get the first rdr entry");
goto end;
}
}
dbg("Ran %d tests", testnum);
/* if there is any failures, the test fails */
end:
if(failcount) {
return -1;
}
return(0);
}
示例10: main
//
// Main program
//
int main(int argc, char *argv[])
{
setbuf(stdout, NULL);
long ranseq = 0; // random stress test count
long ranseed = 1; // random seed for it
int arg;
while ((arg = getopt(argc, argv, "r:v")) != -1) {
switch (arg) {
case 'r': {
ranseq = atoi(optarg);
if (const char *colon = strchr(optarg, ':'))
ranseed = atoi(colon + 1);
else
ranseed = getpid() ^ time(NULL);
break;
}
case 'v':
verbose = true;
break;
default:
usage();
}
}
if (optind < argc - 1)
usage();
const char *sequence = argv[optind];
if (sequence && !strcmp(sequence, "+"))
sequence = testCodes;
if (ranseq) { // repeated random (stress test) sequence
if (!sequence)
sequence = testCodes;
printf("*** Random stress test: %ld iterations from <%s> with seed=%ld\n",
ranseq, sequence, ranseed);
srandom(ranseed);
int setSize = strlen(sequence);
for (long n = 0; n < ranseq; n++) {
char type = sequence[random() % setSize];
printf("\n[%ld:%c]", n, type);
runtest(type);
}
printf("*** Random test sequence complete.\n");
exit(0);
} else { // single-pass selected tests sequence
if (!sequence)
sequence = "."; // default to ping test
for (const char *s = sequence; *s; s++)
runtest(*s);
printf("*** Test sequence complete.\n");
exit(0);
}
}
示例11: main
int
main(void)
{
int nf = 0;
failed[0] = '\0';
printf("Test bitvect_test: ");
nf += runtest(boot, NULL, NULL);
nf += runtest(oct_small_num, num_family_setup, num_family_teardown);
nf += runtest(oct_large_num, num_family_setup, num_family_teardown);
printf(" +%d-%d/3 %d%%\n%s",
3-nf, nf, 100*(3-nf)/3, failed);
return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
示例12: main
int main(int argc, char **argv)
{
/* Initialisation */
generate_wellknown_sids();
/* Create security descriptor */
sd = build_sec_desc(acl_printer, NULL, NULL_SID, NULL_SID);
if (!sd) {
printf("FAIL: could not build security descriptor\n");
return 1;
}
/* Run test */
runtest();
/* Return */
if (!failed) {
printf("PASS\n");
return 0;
}
return 1;
}
示例13: dotest
static int dotest(int nchildren, int count, char **argv)
{
pid_t p;
int i;
signal(SIGCHLD, SIG_DFL);
for (i=0; i<nchildren; i++)
{
p=fork();
if (p == -1)
{
perror("fork");
cleanup();
return (1);
}
if (p == 0)
{
close(1);
if (open("/dev/null", O_WRONLY) != 1)
{
perror("open");
exit(1);
}
exit(runtest(count, argv));
}
}
return (cleanup());
}
示例14: main
int main(int ac, char *av[])
{
int lc;
tst_parse_opts(ac, av, NULL, NULL);
setup();
for (lc = 0; TEST_LOOPING(lc); lc++) {
local_flag = PASSED;
runtest();
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed.");
} else {
tst_resm(TFAIL, "Test failed.");
}
tst_rmdir();
/* ??? so we are doing only one loop here ??? */
tst_exit();
}
tst_exit();
}
示例15: main2
ram_reply_t main2(int argc, char *argv[])
{
ramtest_params_t testparams;
ram_reply_t e = RAM_REPLY_INSANE;
RAM_FAIL_TRAP(ram_initialize(NULL, NULL));
RAM_FAIL_TRAP(initdefaults(&testparams));
e = parseargs(&testparams, argc, argv);
switch (e)
{
default:
RAM_FAIL_TRAP(e);
case RAM_REPLY_OK:
break;
case RAM_REPLY_INPUTFAIL:
return e;
}
e = runtest(&testparams);
switch (e)
{
default:
RAM_FAIL_TRAP(e);
case RAM_REPLY_OK:
break;
case RAM_REPLY_INPUTFAIL:
return e;
}
return RAM_REPLY_OK;
}