本文整理汇总了C++中report_failure函数的典型用法代码示例。如果您正苦于以下问题:C++ report_failure函数的具体用法?C++ report_failure怎么用?C++ report_failure使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了report_failure函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: domapread
static
void
domapread(unsigned offset, unsigned size)
{
unsigned pg_offset;
unsigned map_size;
char *p;
offset -= offset % readbdy;
if (size == 0) {
if (!quiet && testcalls > simulatedopcount)
prt("skipping zero size read\n");
log4(OP_SKIPPED, OP_MAPREAD, offset, size);
return;
}
if (size + offset > file_size) {
if (!quiet && testcalls > simulatedopcount)
prt("skipping seek/read past end of file\n");
log4(OP_SKIPPED, OP_MAPREAD, offset, size);
return;
}
log4(OP_MAPREAD, offset, size, 0);
if (testcalls <= simulatedopcount)
return;
if (!quiet && ((progressinterval &&
testcalls % progressinterval == 0) ||
(debug &&
(monitorstart == -1 ||
(offset + size > monitorstart &&
(monitorend == -1 || offset <= monitorend))))))
prt("%lu mapread\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
offset, offset + size - 1, size);
pg_offset = offset & page_mask;
map_size = pg_offset + size;
if ((p = (char *)mmap(0, map_size, PROT_READ, MAP_FILE | MAP_SHARED, fd,
(off_t)(offset - pg_offset))) == (char *)-1) {
prterr("domapread: mmap");
report_failure(190);
}
if (setjmp(jmpbuf) == 0) {
jmpbuf_good = 1;
memcpy(temp_buf, p + pg_offset, size);
check_eofpage("Read", offset, p, size);
jmpbuf_good = 0;
} else {
report_failure(1901);
}
if (munmap(p, map_size) != 0) {
prterr("domapread: munmap");
report_failure(191);
}
check_buffers(offset, size);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:60,代码来源:fsx.c
示例2: iter_table_and_call
static void iter_table_and_call(lua_State* LS, int env, const gchar* table_name, lua_CFunction error_handler) {
lua_settop(LS,0);
lua_pushcfunction(LS,error_handler);
lua_pushstring(LS, table_name);
lua_gettable(LS, env);
if (!lua_istable(LS, 2)) {
report_failure("Lua: either `%s' does not exist or it is not a table!\n",table_name);
lua_close(LS);
L = NULL;
return;
}
lua_pushnil(LS);
while (lua_next(LS, 2)) {
const gchar* name = lua_tostring(L,-2);
if (lua_isfunction(LS,-1)) {
if ( lua_pcall(LS,0,0,1) ) {
lua_pop(LS,1);
}
} else {
report_failure("Lua: Something not a function got its way into the %s.%s",table_name,name);
lua_close(LS);
L = NULL;
return;
}
}
lua_settop(LS,0);
}
开发者ID:AkhilaAG,项目名称:gluster-wireshark-1.4,代码行数:35,代码来源:init_wslua.c
示例3: dowrite
void
dowrite(unsigned offset, unsigned size)
{
ssize_t ret;
off_t newsize;
offset -= offset % writebdy;
if (o_direct)
size -= size % writebdy;
if (size == 0) {
if (!quiet && testcalls > simulatedopcount && !o_direct)
prt("skipping zero size write\n");
log4(OP_SKIPPED, OP_WRITE, offset, size);
return;
}
log4(OP_WRITE, offset, size, file_size);
gendata(original_buf, good_buf, offset, size);
if (file_size < offset + size) {
newsize = ceil(((double)offset + size) / truncbdy) * truncbdy;
if (file_size < newsize)
memset(good_buf + file_size, '\0', newsize - file_size);
file_size = newsize;
if (lite) {
warn("Lite file size bug in fsx!");
report_failure(149);
}
ret = rbd_resize(image, newsize);
if (ret < 0) {
prterrcode("dowrite: resize", ret);
report_failure(150);
}
}
if (testcalls <= simulatedopcount)
return;
if (!quiet &&
((progressinterval && testcalls % progressinterval == 0) ||
(debug &&
(monitorstart == -1 ||
(offset + size > monitorstart &&
(monitorend == -1 || offset <= monitorend))))))
prt("%lu write\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
offset, offset + size - 1, size);
ret = rbd_write(image, offset, size, good_buf + offset);
if (ret != size) {
if (ret < 0)
prterrcode("dowrite: rbd_write", ret);
else
prt("short write: 0x%x bytes instead of 0x%x\n",
ret, size);
report_failure(151);
}
if (flush) {
doflush(offset, size);
}
}
开发者ID:BillTheBest,项目名称:ceph,代码行数:60,代码来源:fsx.c
示例4: docloseopen
void
docloseopen(void)
{
char *name;
int ret;
if (testcalls <= simulatedopcount)
return;
name = strdup(ctx.name);
if (debug)
prt("%lu close/open\n", testcalls);
ret = ops->close(&ctx);
if (ret < 0) {
prterrcode("docloseopen: ops->close", ret);
report_failure(180);
}
ret = ops->open(name, &ctx);
if (ret < 0) {
prterrcode("docloseopen: ops->open", ret);
report_failure(181);
}
free(name);
}
开发者ID:CzBiX,项目名称:ceph,代码行数:28,代码来源:fsx.c
示例5: doflush
void
doflush(unsigned offset, unsigned size)
{
unsigned pg_offset;
unsigned map_size;
char *p;
if (o_direct == O_DIRECT)
return;
pg_offset = offset & mmap_mask;
map_size = pg_offset + size;
if ((p = (char *)mmap(0, map_size, PROT_READ | PROT_WRITE,
MAP_FILE | MAP_SHARED, fd,
(off_t)(offset - pg_offset))) == (char *)-1) {
prterr("doflush: mmap");
report_failure(202);
}
if (msync(p, map_size, MS_INVALIDATE) != 0) {
prterr("doflush: msync");
report_failure(203);
}
if (munmap(p, map_size) != 0) {
prterr("doflush: munmap");
report_failure(204);
}
}
开发者ID:151706061,项目名称:osv,代码行数:28,代码来源:misc-fsx.c
示例6: dowrite
static
void
dowrite(unsigned offset, unsigned size)
{
off_t ret;
unsigned iret;
offset -= offset % writebdy;
if (size == 0) {
if (!quiet && testcalls > simulatedopcount)
prt("skipping zero size write\n");
log4(OP_SKIPPED, OP_WRITE, offset, size);
return;
}
log4(OP_WRITE, offset, size, file_size);
gendata(original_buf, good_buf, offset, size);
if (file_size < offset + size) {
if (file_size < offset)
memset(good_buf + file_size, '\0', offset - file_size);
file_size = offset + size;
if (lite) {
warn("Lite file size bug in fsx!");
report_failure(149);
}
}
if (testcalls <= simulatedopcount)
return;
if (!quiet && ((progressinterval &&
testcalls % progressinterval == 0) ||
(debug &&
(monitorstart == -1 ||
(offset + size > monitorstart &&
(monitorend == -1 || offset <= monitorend))))))
prt("%lu write\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
offset, offset + size - 1, size);
ret = lseek(fd, (off_t)offset, SEEK_SET);
if (ret == (off_t)-1) {
prterr("dowrite: lseek");
report_failure(150);
}
iret = write(fd, good_buf + offset, size);
if (iret != size) {
if (iret == -1)
prterr("dowrite: write");
else
prt("short write: 0x%x bytes instead of 0x%x\n",
iret, size);
report_failure(151);
}
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:54,代码来源:fsx.c
示例7: doread
void
doread(unsigned offset, unsigned size)
{
off_t ret;
unsigned iret;
offset -= offset % readbdy;
if (o_direct)
size -= size % readbdy;
if (size == 0) {
if (!quiet && testcalls > simulatedopcount && !o_direct)
prt("skipping zero size read\n");
log4(OP_SKIPPED, OP_READ, offset, size);
return;
}
if (size + offset > file_size) {
if (!quiet && testcalls > simulatedopcount)
prt("skipping seek/read past end of file\n");
log4(OP_SKIPPED, OP_READ, offset, size);
return;
}
log4(OP_READ, offset, size, 0);
if (testcalls <= simulatedopcount)
return;
if (!quiet &&
((progressinterval && testcalls % progressinterval == 0) ||
(fsx_debug &&
(monitorstart == -1 ||
(offset + size > monitorstart &&
(monitorend == -1 || offset <= monitorend))))))
prt("%lu read\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
offset, offset + size - 1, size);
ret = lseek(fd, (off_t)offset, SEEK_SET);
if (ret == (off_t)-1) {
prterr("doread: lseek");
report_failure(140);
}
iret = fsxread(fd, temp_buf, size, offset);
if (iret != size) {
if (iret == -1)
prterr("doread: read");
else
prt("short read: 0x%x bytes instead of 0x%x\n",
iret, size);
report_failure(141);
}
check_buffers(offset, size);
}
开发者ID:151706061,项目名称:osv,代码行数:51,代码来源:misc-fsx.c
示例8: exec_common_fork
static
int
exec_common_fork(int *result)
{
int pid, rv, status, err;
/*
* This does not happen in a test context (from the point of
* view of report.c) so we have to fiddle a bit.
*/
pid = fork();
if (pid<0) {
err = errno;
report_begin("forking for test");
report_result(pid, err);
report_aborted(result);
return -1;
}
if (pid==0) {
/* child */
return 0;
}
rv = waitpid(pid, &status, 0);
if (rv == -1) {
err = errno;
report_begin("waiting for test subprocess");
report_result(rv, err);
report_failure(result);
return -1;
}
if (WIFEXITED(status) && WEXITSTATUS(status) == MAGIC_STATUS) {
*result = SUCCESS;
return 1;
}
/* Oops... */
report_begin("exit code of subprocess; should be %d", MAGIC_STATUS);
if (WIFSIGNALED(status)) {
report_warnx("signal %d", WTERMSIG(status));
}
else {
report_warnx("exit %d", WEXITSTATUS(status));
}
report_failure(result);
return -1;
}
开发者ID:SidhantDuggal,项目名称:os161hack,代码行数:48,代码来源:bad_execv.c
示例9: test_assert_equal_file
/* TODO: hexdump the first bytes that actually differ. */
void
test_assert_equal_file(const char *f1, const char *f2pattern, ...)
{
char f2[1024];
va_list ap;
char buff1[1024];
char buff2[1024];
int fd1, fd2;
int n1, n2;
va_start(ap, f2pattern);
vsprintf(f2, f2pattern, ap);
va_end(ap);
fd1 = open(f1, O_RDONLY);
fd2 = open(f2, O_RDONLY);
for (;;) {
n1 = read(fd1, buff1, sizeof(buff1));
n2 = read(fd2, buff2, sizeof(buff2));
if (n1 != n2)
break;
if (n1 == 0 && n2 == 0)
return;
if (memcmp(buff1, buff2, n1) != 0)
break;
}
fprintf(stderr, "%s:%d: Files are not identical\n", test_filename, test_line);
fprintf(stderr, " file1=\"%s\"\n", f1);
fprintf(stderr, " file2=\"%s\"\n", f2);
report_failure(test_extra);
}
开发者ID:vocho,项目名称:qnxpkgsrcmirror,代码行数:32,代码来源:main.c
示例10: test_assert_equal_string
/* assertEqualString() displays the values of the two strings. */
int
test_assert_equal_string(const char *file, int line,
const char *v1, const char *e1,
const char *v2, const char *e2,
void *extra)
{
++assertions;
if (v1 == NULL || v2 == NULL) {
if (v1 == v2) {
msg[0] = '\0';
return (1);
}
} else if (strcmp(v1, v2) == 0) {
msg[0] = '\0';
return (1);
}
failures ++;
if (!verbose && previous_failures(file, line))
return (0);
fprintf(stderr, "%s:%d: Assertion failed: Strings not equal\n",
file, line);
fprintf(stderr, " %s = ", e1);
strdump(v1);
fprintf(stderr, " (length %d)\n", v1 == NULL ? 0 : strlen(v1));
fprintf(stderr, " %s = ", e2);
strdump(v2);
fprintf(stderr, " (length %d)\n", v2 == NULL ? 0 : strlen(v2));
report_failure(extra);
return (0);
}
开发者ID:vocho,项目名称:qnxpkgsrcmirror,代码行数:31,代码来源:main.c
示例11: dotruncate
void
dotruncate(unsigned size)
{
int oldsize = file_size;
int ret;
size -= size % truncbdy;
if (size > biggest) {
biggest = size;
if (!quiet && testcalls > simulatedopcount)
prt("truncating to largest ever: 0x%x\n", size);
}
log4(OP_TRUNCATE, size, (unsigned)file_size, 0);
if (size > file_size)
memset(good_buf + file_size, '\0', size - file_size);
else if (size < file_size)
memset(good_buf + size, '\0', file_size - size);
file_size = size;
if (testcalls <= simulatedopcount)
return;
if ((progressinterval && testcalls % progressinterval == 0) ||
(debug && (monitorstart == -1 || monitorend == -1 ||
size <= monitorend)))
prt("%lu trunc\tfrom 0x%x to 0x%x\n", testcalls, oldsize, size);
if ((ret = rbd_resize(image, size)) < 0) {
prt("rbd_resize: %x\n", size);
prterrcode("dotruncate: ftruncate", ret);
report_failure(160);
}
}
开发者ID:BillTheBest,项目名称:ceph,代码行数:34,代码来源:fsx.c
示例12: check_eofpage
void
check_eofpage(char *s, unsigned offset, char *p, int size)
{
unsigned long last_page, should_be_zero;
if (offset + size <= (file_size & ~page_mask))
return;
/*
* we landed in the last page of the file
* test to make sure the VM system provided 0's
* beyond the true end of the file mapping
* (as required by mmap def in 1996 posix 1003.1)
*/
last_page = ((unsigned long)p + (offset & page_mask) + size) & ~page_mask;
for (should_be_zero = last_page + (file_size & page_mask);
should_be_zero < last_page + page_size;
should_be_zero++)
if (*(char *)should_be_zero) {
prt("Mapped %s: non-zero data past EOF (0x%llx) page offset 0x%x is 0x%04x\n",
s, file_size - 1, should_be_zero & page_mask,
short_at(should_be_zero));
report_failure(205);
}
}
开发者ID:BillTheBest,项目名称:ceph,代码行数:25,代码来源:fsx.c
示例13: test_assert_equal_wstring
/* assertEqualWString() displays the values of the two strings. */
int
test_assert_equal_wstring(const char *file, int line,
const wchar_t *v1, const char *e1,
const wchar_t *v2, const char *e2,
void *extra)
{
++assertions;
if (v1 == NULL) {
if (v2 == NULL) {
msg[0] = '\0';
return (1);
}
} else if (v2 == NULL) {
if (v1 == NULL) {
msg[0] = '\0';
return (1);
}
} else if (wcscmp(v1, v2) == 0) {
msg[0] = '\0';
return (1);
}
failures ++;
if (!verbose && previous_failures(file, line))
return (0);
fprintf(stderr, "%s:%d: Assertion failed: Unicode strings not equal\n",
file, line);
fprintf(stderr, " %s = ", e1);
wcsdump(v1);
fprintf(stderr, "\n");
fprintf(stderr, " %s = ", e2);
wcsdump(v2);
fprintf(stderr, "\n");
report_failure(extra);
return (0);
}
开发者ID:vocho,项目名称:qnxpkgsrcmirror,代码行数:36,代码来源:main.c
示例14: filehandler_cb_error_handler
static int filehandler_cb_error_handler(lua_State* L) {
const gchar* error = lua_tostring(L,1);
const gchar* functype = luaL_optstring(L, lua_upvalueindex(1), "UNKNOWN");
report_failure("Lua: Error During execution of FileHandler %s callback:\n %s",functype,error);
lua_pop(L, 1);
return 0;
}
开发者ID:halolpd,项目名称:wireshark,代码行数:7,代码来源:wslua_file_handler.c
示例15: dotruncate
void
dotruncate(unsigned size)
{
int oldsize = file_size;
size -= size % truncbdy;
if (size > biggest) {
biggest = size;
if (!quiet && testcalls > simulatedopcount)
prt("truncating to largest ever: 0x%x\n", size);
}
log4(OP_TRUNCATE, size, (unsigned)file_size, 0);
if (size > file_size)
memset(good_buf + file_size, '\0', size - file_size);
file_size = size;
if (testcalls <= simulatedopcount)
return;
if ((progressinterval && testcalls % progressinterval == 0) ||
(fsx_debug && (monitorstart == -1 || monitorend == -1 ||
size <= monitorend)))
prt("%lu trunc\tfrom 0x%x to 0x%x\n", testcalls, oldsize, size);
if (ftruncate(fd, (off_t)size) == -1) {
prt("ftruncate1: %x\n", size);
prterr("dotruncate: ftruncate");
report_failure(160);
}
}
开发者ID:151706061,项目名称:osv,代码行数:31,代码来源:misc-fsx.c
示例16: test_assert_equal_mem
/* TODO: For long blocks, hexdump the first bytes that actually differ. */
void
test_assert_equal_mem(const char *file, int line,
const char *v1, const char *e1,
const char *v2, const char *e2,
size_t l, const char *ld, void *extra)
{
if (v1 == NULL || v2 == NULL) {
if (v1 == v2) {
msg[0] = '\0';
return;
}
} else if (memcmp(v1, v2, l) == 0) {
msg[0] = '\0';
return;
}
failures ++;
if (previous_failures(file, line))
return;
fprintf(stderr, "%s:%d: Assertion failed: memory not equal\n",
file, line);
fprintf(stderr, " size %s = %d\n", ld, (int)l);
fprintf(stderr, " Dump of %s\n", e1);
hexdump(v1, v2, l < 32 ? l : 32, 0);
fprintf(stderr, " Dump of %s\n", e2);
hexdump(v2, v1, l < 32 ? l : 32, 0);
fprintf(stderr, "\n");
report_failure(extra);
}
开发者ID:vocho,项目名称:qnxpkgsrcmirror,代码行数:29,代码来源:main.c
示例17: report_checkN
static
int
report_checkN(int rv, int error, int *right_errors, int right_num)
{
int i, goterror;
int result = 1;
if (rv==-1) {
goterror = error;
}
else {
goterror = 0;
}
for (i=0; i<right_num; i++) {
if (goterror == right_errors[i]) {
report_result(rv, error);
report_passed(&result);
return result;
}
}
if (goterror == ENOSYS) {
report_saw_enosys();
say("(unimplemented) ");
report_skipped(&result);
}
else {
report_result(rv, error);
report_failure(&result);
}
return result;
}
开发者ID:SidhantDuggal,项目名称:os161hack,代码行数:33,代码来源:report.c
示例18: malloc
static pool_entry *alloc_entry(memory_pool *pool, size_t buffer_size, const char *file, int line)
{
pool_entry *entry;
/* allocate the new entry */
entry = malloc(offsetof(pool_entry, buffer) + buffer_size);
if (entry == NULL)
{
/* failure */
report_failure(pool, "alloc_entry: Failed to allocate %u bytes (%s:%d)", buffer_size, file, line);
return NULL;
}
/* set up the new entry */
memset(entry, 0, offsetof(pool_entry, buffer));
entry->pool = pool;
entry->size = buffer_size;
entry->cookie = MAGIC_COOKIE;
/* add this entry to the linked list */
*pool->lastptr = entry;
pool->lastptr = &entry->next;
#ifdef MAME_DEBUG
/* randomize memory for debugging */
rand_memory(entry->buffer, buffer_size);
#endif
return entry;
}
开发者ID:broftkd,项目名称:historic-mess,代码行数:30,代码来源:pool.c
示例19: piglit_display
enum piglit_result
piglit_display(void)
{
bool pass = true;
float buffer[2 +
ARRAY_SIZE(vertex_array) +
ARRAY_SIZE(color_array) +
ARRAY_SIZE(texcoord_array)];
int i, j;
piglit_ortho_projection(piglit_width, piglit_height, false);
glClearColor(0.0, 1.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glVertexPointer(4, GL_FLOAT, 0, vertex_array);
glColorPointer(4, GL_FLOAT, 0, color_array);
glTexCoordPointer(4, GL_FLOAT, 0, texcoord_array);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
for (i = 0; i < ARRAY_SIZE(types); i++) {
bool case_pass = true;
int returned_count;
printf("Testing %s\n", types[i].name);
for (j = 0; j < ARRAY_SIZE(buffer); j++)
buffer[j] = -1.0;
glFeedbackBuffer(ARRAY_SIZE(buffer), types[i].type, buffer);
glRenderMode(GL_FEEDBACK);
glDrawArrays(GL_TRIANGLES, 0, 4);
returned_count = glRenderMode(GL_RENDER);
if (returned_count != types[i].count) {
case_pass = false;
} else {
for (j = 0; j < types[i].count; j++) {
if (fabs(buffer[j] - types[i].values[j]) > .01)
case_pass = false;
}
}
if (!case_pass) {
pass = false;
report_failure(&types[i], buffer, returned_count);
piglit_report_subtest_result(PIGLIT_FAIL,
types[i].name);
} else {
piglit_report_subtest_result(PIGLIT_PASS,
types[i].name);
}
}
piglit_present_results();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
开发者ID:dervishxgit,项目名称:piglit,代码行数:60,代码来源:rendermode-feedback.c
示例20: check_proposal
Vector TIM::draw(const Vector & old){
check_proposal(old.size());
if(!mode_has_been_found_ || !mode_is_fixed_){
bool ok = locate_mode(old);
if(!ok) report_failure(old);
}
return MetropolisHastings::draw(old);
}
开发者ID:MarkEdmondson1234,项目名称:Boom,代码行数:8,代码来源:TIM.cpp
注:本文中的report_failure函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论