18 Star 37 Fork 79

openEuler / UniProton

 / 详情

【2203 sp1】 clock_getres返回值错误,errno未设置

已验收
缺陷
创建于  
2022-12-11 22:38

【标题描述】能够简要描述问题:说明什么场景下,做了什么操作,出现什么问题(尽量使用正向表达方式)
【环境信息】
stm32f407
【问题复现步骤】

/*   
 * Copyright (c) 2002, Intel Corporation. All rights reserved.
 * Created by:  julie.n.fleischer REMOVE-THIS AT intel DOT com
 * This file is licensed under the GPL license.  For the full content
 * of this license, see the COPYING file at the top level of this 
 * source tree.

 * Test that clock_getres() sets errno=EINVAL for a variety of
 * invalid clock_ids.
 *
 * The following invalid clock_ids will be used:
 * - Boundary values for integers (TBD if clock_id is an integer)
 *   MIN INT = INT32_MIN
 *   MAX INT = INT32_MAX
 *   MIN INT - 1 = 2147483647  (this is what gcc will set to)
 *   MAX INT + 1 = -2147483647 (this is what gcc will set to)
 *   unassigned value = -1073743192 (ex. of what gcc will set to)
 *   unassigned value = 1073743192 (ex. of what gcc will set to)
 *   -1
 *   17 (currently not = to any clock)
 *           
 */
#include <stdio.h>
#include <time.h>
#include <errno.h>
#include <stdint.h>
#include "posixtest.h"

#define NUMINVALIDTESTS 8

int clock_getres_6_2(int argc, char *argv[])
{
	struct timespec res;
	int invalid_tests[NUMINVALIDTESTS] = {
		INT32_MIN, INT32_MAX, 2147483647, -2147483647, -1073743192, 
		1073743192, -1, 17};
	int i;
	int failure = 0;

	for (i = 0; i < NUMINVALIDTESTS; i++) {
		printf("clock_getres(%d, &res);\n", invalid_tests[i]);
		if (clock_getres(invalid_tests[i], &res) == -1) {
			if (EINVAL != errno) {
				printf("errno != EINVAL\n");
				failure = 1;
			}
		} else {
			printf("clock_getres() != -1\n");
			failure = 1;
		}
	}

	if (failure) {
		printf("At least one test FAILED -- see above\n");
		return PTS_FAIL;
	} else {
		printf("All tests PASSED\n");
		return PTS_PASS;
	}

	printf("This code should not be executed.\n");
	return PTS_UNRESOLVED;
}

【预期结果】
测试成功
【实际结果】
测试失败
【附件信息】
输入图片说明

评论 (1)

saarloos 创建了缺陷

Hi saarloos, welcome to the openEuler Community.
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here.
If you have any questions, please contact the SIG: sig-embedded, and any of the maintainers: @wl1587 , @beiling.xie , @linzichang , @Wayne Ren

openeuler-ci-bot 添加了
 
sig/sig-embedded
标签
saarloos 修改了描述
saarloos 任务状态待办的 修改为已验收

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(2)
5329419 openeuler ci bot 1632792936
1
https://gitee.com/openeuler/UniProton.git
git@gitee.com:openeuler/UniProton.git
openeuler
UniProton
UniProton

搜索帮助