您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ tst_kvercmp函数代码示例

51自学网 2021-06-03 08:59:40
  C++
这篇教程C++ tst_kvercmp函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中tst_kvercmp函数的典型用法代码示例。如果您正苦于以下问题:C++ tst_kvercmp函数的具体用法?C++ tst_kvercmp怎么用?C++ tst_kvercmp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了tst_kvercmp函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: test03

static void test03(void){    tst_resm(TINFO, "zeroing file space with FALLOC_FL_ZERO_RANGE");    if (tst_kvercmp(3, 15, 0) < 0) {        tst_brkm(TCONF, cleanup,                 "FALLOC_FL_ZERO_RANGE needs Linux 3.15 or newer");    }    size_t alloc_size0 = get_allocsize();    tst_resm(TINFO, "read current allocated file size '%zu'", alloc_size0);    if (fallocate(fd, FALLOC_FL_ZERO_RANGE, block_size - 1,                  block_size + 2) == -1) {        if (errno == EOPNOTSUPP) {            tst_brkm(TCONF, cleanup,                     "FALLOC_FL_ZERO_RANGE not supported");        }        tst_brkm(TFAIL | TERRNO, cleanup, "fallocate failed");    }    /* The file hole in the specified range must be allocated and     * filled with zeros. Check it.     */    size_t alloc_size1 = get_allocsize();    tst_resm(TINFO, "allocated file size before '%zu' and after '%zu'",             alloc_size0, alloc_size1);    if ((alloc_size0 + block_size) != alloc_size1)        tst_brkm(TFAIL, cleanup, "not expected allocated size");    char exp_buf[buf_size];    fill_tst_buf(exp_buf);    memset(exp_buf + block_size - 1, 0, block_size + 2);    check_file_data(exp_buf, buf_size);    tst_resm(TPASS, "test-case succeeded");}
开发者ID:karabijavad,项目名称:ltp,代码行数:41,


示例2: setup

static void setup(void){	const char *mount_flags[] = {"noatime", "relatime", NULL};	TEST_PAUSE;	tst_sig(FORK, DEF_HANDLER, cleanup);	tst_tmpdir();	SAFE_MKDIR(cleanup, MNTPOINT, DIR_MODE);	if (tst_path_has_mnt_flags(cleanup, NULL, mount_flags)) {		const char *fs_type;		if ((tst_kvercmp(2, 6, 30)) < 0) {			tst_resm(TCONF,				"MS_STRICTATIME flags for mount(2) needs kernel 2.6.30 "				"or higher");			skip_noatime = 1;			return;		}		fs_type = tst_dev_fs_type();		device = tst_acquire_device(cleanup);		if (!device) {			tst_resm(TINFO, "Failed to obtain block device");			skip_noatime = 1;			goto end;		}		tst_mkfs(cleanup, device, fs_type, NULL, NULL);		SAFE_MOUNT(cleanup, device, MNTPOINT, fs_type, MS_STRICTATIME, NULL);		mount_flag = 1;	}end:	SAFE_FILE_PRINTF(cleanup, TEST_FILE, TEST_FILE);}
开发者ID:CSRedRat,项目名称:ltp,代码行数:41,


示例3: main

int main(int argc, char *argv[]){	int lc;	int i;	int exp_eno;	char *msg;	char buf[BUFSIZ];	msg = parse_opts(argc, argv, NULL, NULL);	if (msg != NULL)		tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg);	setup();	for (lc = 0; TEST_LOOPING(lc); lc++) {		tst_count = 0;		/*		 * Before kernel 3.0.0, getxattr(2) will set errno with 'EPERM'		 * when the file is not a regular file and directory, refer to		 * commitid 55b23bd		 */		if (tst_kvercmp(3, 0, 0) >= 0)			exp_eno = ENODATA;		else			exp_eno = EPERM;		for (i = 0; i < TST_TOTAL; i++) {			TEST(getxattr(tc[0], XATTR_TEST_KEY, buf, BUFSIZ));			if (TEST_RETURN == -1 && TEST_ERRNO == exp_eno)				tst_resm(TPASS | TTERRNO, "expected behavior");			else				tst_resm(TFAIL | TTERRNO, "unexpected behavior"					 " - expected errno %d - Got", exp_eno);		}	}	cleanup();	tst_exit();}
开发者ID:Altiscale,项目名称:sig-core-t_ltp,代码行数:41,


示例4: setup

/* setup() - performs all ONE TIME setup for this test */void setup(void){	tst_sig(NOFORK, DEF_HANDLER, cleanup);	tst_require_root(NULL);	if (tst_kvercmp(2, 5, 48) >= 0)		tst_brkm(TCONF, NULL, "This test will not work on "			 "kernels after 2.5.48");	/* Pause if that option was specified	 * TEST_PAUSE contains the code to fork the test with the -c option.	 */	TEST_PAUSE;	/* Initialize unique module name for each child process */	if (sprintf(modname, "%s_%d", BASEMODNAME, getpid()) == -1) {		tst_brkm(TBROK, NULL, "Failed to initialize module name");	}}
开发者ID:AbhiramiP,项目名称:ltp,代码行数:22,


示例5: setup

static void setup(void){	if ((tst_kvercmp(3, 15, 0)) < 0) {		tst_brkm(TCONF, NULL,			"This test can only run on kernels that are 3.15. and higher");	}	tst_tmpdir();	fs_type = tst_fs_type(cleanup, ".");	SAFE_MKDIR(cleanup, TEST_DIR, 0700);	SAFE_MKDIR(cleanup, TEST_DIR2, 0700);	SAFE_TOUCH(cleanup, TEST_DIR TEST_FILE, 0600, NULL);	SAFE_TOUCH(cleanup, TEST_DIR2 TEST_FILE2, 0600, NULL);	SAFE_TOUCH(cleanup, TEST_DIR TEST_FILE3, 0600, NULL);	olddirfd = SAFE_OPEN(cleanup, TEST_DIR, O_DIRECTORY);	newdirfd = SAFE_OPEN(cleanup, TEST_DIR2, O_DIRECTORY);}
开发者ID:CSRedRat,项目名称:ltp,代码行数:21,


示例6: main

int main(int argc, char *argv[]){	int fd, coe;	if ((tst_kvercmp(2, 6, 27)) < 0) {		tst_brkm(TCONF, NULL,		    "This test can only run on kernels that are 2.6.27 and higher");	}	setup();	fd = syscall(__NR_eventfd2, 1, 0);	if (fd == -1) {		tst_brkm(TFAIL, cleanup, "eventfd2(0) failed");	}	coe = fcntl(fd, F_GETFD);	if (coe == -1) {		tst_brkm(TBROK, cleanup, "fcntl failed");	}	if (coe & FD_CLOEXEC) {		tst_brkm(TFAIL, cleanup, "eventfd2(0) set close-on-exec flag");	}	close(fd);	fd = syscall(__NR_eventfd2, 1, EFD_CLOEXEC);	if (fd == -1) {		tst_brkm(TFAIL, cleanup, "eventfd2(EFD_CLOEXEC) failed");	}	coe = fcntl(fd, F_GETFD);	if (coe == -1) {		tst_brkm(TBROK, cleanup, "fcntl failed");	}	if ((coe & FD_CLOEXEC) == 0) {		tst_brkm(TFAIL, cleanup,			 "eventfd2(EFD_CLOEXEC) does not set close-on-exec flag");	}	close(fd);	tst_resm(TPASS, "eventfd2(EFD_CLOEXEC) Passed");	cleanup();	tst_exit();}
开发者ID:Mellanox,项目名称:arc_ltp,代码行数:40,


示例7: main

int main(int argc, char *argv[]){	int fd, coe;	if ((tst_kvercmp(2, 6, 27)) < 0)		tst_brkm(TCONF, NULL,			 "This test can only run on kernels that are 2.6.27 and higher");	setup();	fd = ltp_syscall(__NR_dup3, 1, 4, 0);	if (fd == -1) {		tst_brkm(TFAIL | TERRNO, cleanup, "dup3(0) failed");	}	coe = fcntl(fd, F_GETFD);	if (coe == -1) {		tst_brkm(TBROK | TERRNO, cleanup, "fcntl failed");	}	if (coe & FD_CLOEXEC) {		tst_brkm(TFAIL, cleanup, "dup3(0) set close-on-exec flag");	}	close(fd);	fd = ltp_syscall(__NR_dup3, 1, 4, O_CLOEXEC);	if (fd == -1) {		tst_brkm(TFAIL | TERRNO, cleanup, "dup3(O_CLOEXEC) failed");	}	coe = fcntl(fd, F_GETFD);	if (coe == -1) {		tst_brkm(TBROK | TERRNO, cleanup, "fcntl failed");	}	if ((coe & FD_CLOEXEC) == 0) {		tst_brkm(TFAIL, cleanup,			 "dup3(O_CLOEXEC) set close-on-exec flag");	}	close(fd);	tst_resm(TPASS, "dup3(O_CLOEXEC) PASSED");	cleanup();	tst_exit();}
开发者ID:HarryWeppner,项目名称:ltp,代码行数:40,


示例8: main

int main(int ac, char **av){	int lc;	int i;	/* Disable test if the version of the kernel is less than 2.6.16 */	if ((tst_kvercmp(2, 6, 16)) < 0) {		tst_resm(TWARN, "This test can only run on kernels that are ");		tst_resm(TWARN, "2.6.16 and higher");		exit(0);	}	tst_parse_opts(ac, av, NULL, NULL);	setup();	for (lc = 0; TEST_LOOPING(lc); lc++) {		setup_every_copy();		tst_count = 0;		for (i = 0; i < TST_TOTAL; i++) {			TEST(myunlinkat(fds[i], filenames[i], flags[i]));			if (TEST_ERRNO == expected_errno[i]) {				tst_resm(TPASS,					 "unlinkat() returned the expected  errno %d: %s",					 TEST_ERRNO, strerror(TEST_ERRNO));			} else {				tst_resm(TFAIL,					 "unlinkat() Failed, errno=%d : %s",					 TEST_ERRNO, strerror(TEST_ERRNO));			}		}	}	cleanup();	tst_exit();}
开发者ID:AbhiramiP,项目名称:ltp,代码行数:40,


示例9: main

int main(int ac, char **av){	int lc;	int i;	/* Disable test if the version of the kernel is less than 2.6.16 */	if ((tst_kvercmp(2, 6, 16)) < 0)		tst_brkm(TCONF, NULL, "Test must be run with kernel 2.6.16+");	tst_parse_opts(ac, av, NULL, NULL);	setup();	for (lc = 0; TEST_LOOPING(lc); lc++) {		tst_count = 0;		/*		 * Call faccessat		 */		for (i = 0; i < TST_TOTAL; i++) {			TEST(myfaccessat(fds[i], filenames[i], R_OK));			/* check return code */			if (TEST_ERRNO == expected_errno[i]) {				tst_resm(TPASS,					 "faccessat() returned the expected  errno %d: %s",					 TEST_ERRNO,					 strerror(TEST_ERRNO));			} else {				tst_resm(TFAIL,					 "faccessdat() Failed, errno=%d : %s",					 TEST_ERRNO, strerror(TEST_ERRNO));			}		}	}	cleanup();	tst_exit();}
开发者ID:1587,项目名称:ltp,代码行数:39,


示例10: test_noatime

static void test_noatime(void){	char read_buf;	struct stat old_stat, new_stat;	if ((tst_kvercmp(2, 6, 8)) < 0) {		tst_resm(TCONF,			 "O_NOATIME flags test for open(2) needs kernel 2.6.8 "			 "or higher");		return;	}	if (skip_noatime) {		tst_resm(TCONF,		         "test O_NOATIME flag for open needs filesystems which "		         "is mounted without noatime and relatime");		return;	}	SAFE_STAT(cleanup, TEST_FILE, &old_stat);	sleep(1);	TEST(open(TEST_FILE, O_RDONLY | O_NOATIME, 0777));	if (TEST_RETURN == -1) {		tst_resm(TFAIL | TTERRNO, "open failed");		return;	}	SAFE_READ(cleanup, 1, TEST_RETURN, &read_buf, 1);	SAFE_CLOSE(cleanup, TEST_RETURN);	SAFE_STAT(cleanup, TEST_FILE, &new_stat);	if (old_stat.st_atime == new_stat.st_atime)		tst_resm(TPASS, "test O_NOATIME for open success");	else		tst_resm(TFAIL, "test O_NOATIME for open failed");}
开发者ID:CSRedRat,项目名称:ltp,代码行数:38,


示例11: setup

static void setup(void){	int i;	if ((tst_kvercmp(2, 6, 17)) < 0) {		tst_brkm(TCONF, NULL,		         "The vmsplice is supported 2.6.17 and newer");	}	tst_sig(NOFORK, DEF_HANDLER, cleanup);	tst_tmpdir();	if (tst_fs_type(cleanup, ".") == TST_NFS_MAGIC) {		tst_brkm(TCONF, cleanup, "Cannot do splice() "			 "on a file located on an NFS filesystem");	}	for (i = 0; i < TEST_BLOCK_SIZE; i++)		buffer[i] = i & 0xff;	TEST_PAUSE;}
开发者ID:AbhiramiP,项目名称:ltp,代码行数:23,


示例12: setup

/* * setup() - performs all ONE TIME setup for this test */static void setup(void){	/*	 * commit 3140a2273009c01c27d316f35ab76a37e105fdd8	 * Author: Brice Goglin <[email
C++ tst_parse_opts函数代码示例
C++ tst_brkm函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。