summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2014-07-29 18:40:49 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2014-07-29 18:40:49 +0800
commit6c2e5aeafe36950972bc039e3b3bd67be7cb7369 (patch)
treefffbfa0eca9b590c0ebe37945a83e108bd601427
parent1e318ce4d3c7e06cbd66260c5d6c6ec13511c01b (diff)
downloadlinaro-android-kernel-test-6c2e5aeafe36950972bc039e3b3bd67be7cb7369.tar.gz
evdevtest: fix error and rename test names
chanage accorfing to cards: https://cards.linaro.org/browse/JUICE-443 1. fix value get by ioctl comparison problem 2. rename test case names Change-Id: Ic061d4630cb1b112ad342cc858b7d75ffc0964e8 Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
-rw-r--r--evdevtest/juice_evtest.c91
1 files changed, 45 insertions, 46 deletions
diff --git a/evdevtest/juice_evtest.c b/evdevtest/juice_evtest.c
index 66f98e4..32ddf2b 100644
--- a/evdevtest/juice_evtest.c
+++ b/evdevtest/juice_evtest.c
@@ -129,7 +129,7 @@ int main (int argc, char **argv)
char * shopt = "p:h";
char *evdevice = NULL;
- long enable_lock = 1, disable_lock = 0, lockvalue = -1;
+ unsigned int enable_lock = 1, disable_lock = 0, lockvalue = -1;
int fd, c, opti = 0, ret;
unsigned int clk;
struct input_event ev[64];
@@ -165,32 +165,31 @@ int main (int argc, char **argv)
return -1;
}
-
printf("===========================\n");
printf("Starting input ioctl cmd EVIOCGSUSPENDBLOCK/EVIOCCSUSPENDBLOCK test:\n");
/* Read lock command */
if (ioctl(fd, EVIOCGSUSPENDBLOCK, &lockvalue))
- printf("[EVDEV_EVIOCGSUSPENDBLOCK_READ_TEST1]: test failed\n");
+ printf("[EVDEV_EVIOCGSUSPENDBLOCK_READ]: test failed\n");
else
- printf("[EVDEV_EVIOCGSUSPENDBLOCK_READ_TEST1]: test passed\n");
+ printf("[EVDEV_EVIOCGSUSPENDBLOCK_READ]: test passed\n");
if (0 == lockvalue) /*default lock value*/
- printf("[EVDEV_TEST2]: test passed\n");
+ printf("[EVDEV_EVIOCGSUSPENDBLOCK_VALUE_ZERO]: test passed\n");
else
- printf("[EVDEV_TEST2]: test failed\n");
+ printf("[EVDEV_EVIOCGSUSPENDBLOCK_VALUE_ZERO]: test failed\n");
/*Set user_wake_lock*/
if (ioctl(fd, EVIOCSSUSPENDBLOCK, enable_lock))
- printf("[EVDEV_EVIOCSSUSPENDBLOCK_SET_TEST3]: test failed\n");
+ printf("[EVDEV_EVIOCSSUSPENDBLOCK_SET]: test failed\n");
else
- printf("[EVDEV_EVIOCSSUSPENDBLOCK_SET_TEST3]: test passed\n");
+ printf("[EVDEV_EVIOCSSUSPENDBLOCK_SET]: test passed\n");
/*Verfify the lock value equals what we set*/
ioctl(fd, EVIOCGSUSPENDBLOCK, &lockvalue);
if (enable_lock == lockvalue)
- printf("[EVDEV_TEST4]: test passed\n");
+ printf("[EVDEV_EVIOCSSUSPENDBLOCK_ENABLED]: test passed\n");
else {
- printf("[EVDEV_TEST4]: test failed\n");
+ printf("[EVDEV_EVIOCSSUSPENDBLOCK_ENABLED]: test failed\n");
goto para_test;
}
@@ -204,24 +203,24 @@ int main (int argc, char **argv)
/*Judge the system can not suspend*/
ret = suspend_resume_test(DELAY);
if (1 == ret)
- printf("[EVDEV_CMD_DISABLE_SUSPEND_TEST5]: test passed\n");
+ printf("[EVDEV_CMD_DISABLE_SUSPEND]: test passed\n");
else
- printf("[EVDEV_CMD_DISABLE_SUSPEND_TEST5]: test failed\n");
+ printf("[EVDEV_CMD_DISABLE_SUSPEND]: test failed\n");
/*Disable evdev usr_wake_lock*/
ioctl(fd, EVIOCSSUSPENDBLOCK, disable_lock);
ioctl(fd, EVIOCGSUSPENDBLOCK, &lockvalue);
if ( disable_lock == lockvalue )
- printf("[EVDEV_TEST6]: test passed\n");
+ printf("[EVDEV_EVIOCSSUSPENDBLOCK_DISABLED]: test passed\n");
else
- printf("[EVDEV_TEST6]: test failed\n");
+ printf("[EVDEV_EVIOCSSUSPENDBLOCK_DISABLED]: test failed\n");
/*Judge the system can be suspend resume*/
ret = suspend_resume_test(DELAY);
if (0 == ret)
- printf("[EVDEV_ENABLE_SUSPEND_RESUME_TEST7]: test passed\n");
+ printf("[EVDEV_ENABLE_SUSPEND_RESUME]: test passed\n");
else
- printf("[EVDEV_ENABLE_SUSPEND_RESUME_TEST7]: test failed\n");
+ printf("[EVDEV_ENABLE_SUSPEND_RESUME]: test failed\n");
/*Stop generateing input event*/
ret = system("echo 0 > /sys/juice_input/run");
@@ -238,54 +237,54 @@ para_test:
printf("Starting test EVIOCGSUSPENDBLOCK/EVIOCSSUSPENDBLOCK with different parameters:\n");
ret = ioctl(fd, EVIOCGSUSPENDBLOCK, NULL);
if (ret < 0)
- printf("[EVDEV_TEST8]: test passed\n");
+ printf("[EVDEV_PARA_EVIOCGSUSPENDBLOCK_NULL]: test passed\n");
else
- printf("[EVDEV_TEST8]: test failed\n");
+ printf("[EVDEV_PARA_EVIOCGSUSPENDBLOCK_NULL]: test failed\n");
ret = ioctl(fd, EVIOCSSUSPENDBLOCK, NULL);
if (!ret)
- printf("[EVDEV_TEST9]: test passed\n");
+ printf("[EVDEV_PARA_EVIOCSSUSPENDBLOCK_NULL]: test passed\n");
else
- printf("[EVDEV_TEST9]: test failed\n");
+ printf("[EVDEV_PARA_EVIOCSSUSPENDBLOCK_NULL]: test failed\n");
/* byte parameters test*/
ret = ioctl(fd, EVIOCGSUSPENDBLOCK, &parameter1);
if (!ret)
- printf("[EVDEV_TEST10]: test passed\n");
+ printf("[EVDEV_PARA_EVIOCGSUSPENDBLOCK_CHAR]: test passed\n");
else
- printf("[EVDEV_TEST10]: test failed\n");
+ printf("[EVDEV_PARA_EVIOCGSUSPENDBLOCK_CHAR]: test failed\n");
ret = ioctl(fd, EVIOCSSUSPENDBLOCK, parameter1);
if (!ret)
- printf("[EVDEV_TEST11]: test passed\n");
+ printf("[EVDEV_PARA_EVIOCSSUSPENDBLOCK_CHAR]: test passed\n");
else
- printf("[EVDEV_TEST11]: test failed\n");
+ printf("[EVDEV_PARA_EVIOCSSUSPENDBLOCK_CHAR]: test failed\n");
/* int parameters test*/
ret = ioctl(fd, EVIOCGSUSPENDBLOCK, &parameter2);
if (!ret)
- printf("[EVDEV_TEST12]: test passed\n");
+ printf("[EVDEV_PARA_EVIOCGSUSPENDBLOCK_INT]: test passed\n");
else
- printf("[EVDEV_TEST12]: test failed\n");
+ printf("[EVDEV_PARA_EVIOCGSUSPENDBLOCK_INT]: test failed\n");
ret = ioctl(fd, EVIOCSSUSPENDBLOCK, parameter2);
if (!ret)
- printf("[EVDEV_TEST13]: test passed\n");
+ printf("[EVDEV_PARA_EVIOCSSUSPENDBLOCK_INT]: test passed\n");
else
- printf("[EVDEV_TEST13]: test failed\n");
+ printf("[EVDEV_PARA_EVIOCSSUSPENDBLOCK_INT]: test failed\n");
/* 64bit parameters test*/
ret = ioctl(fd, EVIOCGSUSPENDBLOCK, &parameter3);
if (!ret)
- printf("[EVDEV_TEST14]: test passed\n");
+ printf("[EVDEV_PARA_EVIOCGSUSPENDBLOCK_LONG_LONG]: test passed\n");
else
- printf("[EVDEV_TEST14]: test failed\n");
+ printf("[EVDEV_PARA_EVIOCGSUSPENDBLOCK_LONG_LONG]: test failed\n");
ret = ioctl(fd, EVIOCSSUSPENDBLOCK, parameter3);
if (!ret)
- printf("[EVDEV_TEST15]: test passed\n");
+ printf("[EVDEV_PARA_EVIOCSSUSPENDBLOCK_LONG_LONG]: test passed\n");
else
- printf("[EVDEV_TEST15]: test failed\n");
+ printf("[EVDEV_PARA_EVIOCSSUSPENDBLOCK_LONG_LONG]: test failed\n");
@@ -295,31 +294,31 @@ para_test:
clk = CLOCK_REALTIME_ALARM;
ret = ioctl(fd, EVIOCSCLOCKID, &clk);
if (ret < 0)
- printf("[EVDEV_TEST16]: test passed\n");
+ printf("[EVDEV_EVIOCSCLOCKID_CLOCK_REALTIME_ALARM]: test passed\n");
else
- printf("[EVDEV_TEST16]: test failed\n");
+ printf("[EVDEV_EVIOCSCLOCKID_CLOCK_REALTIME_ALARM]: test failed\n");
clk = CLOCK_BOOTTIME;
ret = ioctl(fd, EVIOCSCLOCKID, &clk);
if (ret < 0)
- printf("[EVDEV_TEST17]: test passed\n");
+ printf("[EVDEV_EVIOCSCLOCKID_CLOCK_BOOTTIME]: test passed\n");
else
- printf("[EVDEV_TEST17]: test failed\n");
+ printf("[EVDEV_EVIOCSCLOCKID_CLOCK_BOOTTIME]: test failed\n");
ret = ioctl(fd, EVIOCSCLOCKID, NULL);
if (ret < 0)
- printf("[EVDEV_TEST18]: test passed\n");
+ printf("[EVDEV_EVIOCSCLOCKID_NULL]: test passed\n");
else
- printf("[EVDEV_TEST18]: test failed\n");
+ printf("[EVDEV_EVIOCSCLOCKID_NULL]: test failed\n");
/*EVIOCSCLOCKID with CLOCK_REALTIME test start*/
clk = CLOCK_REALTIME;
ret = ioctl(fd, EVIOCSCLOCKID, &clk);
if (ret < 0)
- printf("[EVDEV_TEST19]: test failed\n");
+ printf("[EVDEV_EVIOCSCLOCKID_CLOCK_REALTIME]: test failed\n");
else
- printf("[EVDEV_TEST19]: test passed\n");
+ printf("[EVDEV_EVIOCSCLOCKID_CLOCK_REALTIME]: test passed\n");
/*Start generate event*/
ret = system("echo 1 > /sys/juice_input/run");
@@ -342,9 +341,9 @@ para_test:
JUICE_ERROR("Get time with clock id REALTIME failed");
if (tp1.tv_sec <= ev[0].time.tv_sec && ev[0].time.tv_sec <= tp2.tv_sec)
- printf("[EVDEV_TEST20]: test passed\n");
+ printf("[EVDEV_CLOCK_REALTIME]: test passed\n");
else
- printf("[EVDEV_TEST20]: test failed\n");
+ printf("[EVDEV_CLOCK_REALTIME]: test failed\n");
/*Stop generate input event*/
ret = system("echo 0 > /sys/juice_input/run");
@@ -365,9 +364,9 @@ para_test:
clk = CLOCK_MONOTONIC;
ret = ioctl(fd, EVIOCSCLOCKID, &clk);
if (ret < 0)
- printf("[EVDEV_TEST21]: test failed\n");
+ printf("[EVDEV_EVIOCSCLOCKID_CLOCK_MONOTONIC]: test failed\n");
else
- printf("[EVDEV_TEST21]: test passed\n");
+ printf("[EVDEV_EVIOCSCLOCKID_CLOCK_MONOTONIC]: test passed\n");
ret = system("echo 1 > /sys/juice_input/run");
if (ret < 0) {
@@ -389,9 +388,9 @@ para_test:
JUICE_ERROR("Get time with clock id MONOTONIC failed");
if (tp1.tv_sec <= ev[0].time.tv_sec && ev[0].time.tv_sec<= tp2.tv_sec)
- printf("[EVDEV_TEST22]: test passed\n");
+ printf("[EVDEV_CLOCK_MONOTONIC]: test passed\n");
else
- printf("[EVDEV_TEST22]: test failed\n");
+ printf("[EVDEV_CLOCK_MONOTONIC]: test failed\n");
/*Stop generate input event*/
ret = system("echo 0 > /sys/juice_input/run");