Signed-off-by: Wanlong Gao <[email protected]>
---
include/test.h | 2 +-
lib/tst_kvercmp.c | 31 +++++++++++++++++++------------
2 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/include/test.h b/include/test.h
index a76fafc..57d784e 100644
--- a/include/test.h
+++ b/include/test.h
@@ -178,7 +178,7 @@ struct tst_kern_exv {
char *extra_ver;
};
-int tst_kvercmp2(int r1, int r2, int r3, struct tst_kern_exv *vers);
+int tst_kvercmp2(struct tst_kern_exv *vers);
/* lib/tst_is_cwd.c */
int tst_is_cwd_nfs(void);
diff --git a/lib/tst_kvercmp.c b/lib/tst_kvercmp.c
index 15fb571..f6415c4 100644
--- a/lib/tst_kvercmp.c
+++ b/lib/tst_kvercmp.c
@@ -67,28 +67,35 @@ int tst_kvercmp(int r1, int r2, int r3)
static int tst_kexvcmp(char *tst_exv, char *cur_ver)
{
- int c1 = 0, c2 = 0, t1 = 0, t2 = 0;
+ int c1 = 0, c2 = 0, c3 = 0, c4 = 0, c5 = 0;
+ int t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0;
int ret;
- sscanf(cur_ver, "%*d.%*d.%*d-%d.%d", &c1, &c2);
- sscanf(tst_exv, "%d.%d", &t1, &t2);
+ sscanf(cur_ver, "%d.%d.%d-%d.%d", &c1, &c2, &c3, &c4, &c5);
+ sscanf(tst_exv, "%d.%d.%d-%d.%d", &t1, &t2, &t3, &t4, &t5);
+
if ((ret = c1 - t1))
return ret;
- else
- return c2 - t2;
+ if ((ret = c2 - t2))
+ return ret;
+ if ((ret = c3 - t3))
+ return ret;
+ if ((ret = c4 - t4))
+ return ret;
+
+ return c5 - t5;
}
-int tst_kvercmp2(int r1, int r2, int r3, struct tst_kern_exv *vers)
+/*
+ * Not match any vendor version will retrun 0
+ */
+int tst_kvercmp2(struct tst_kern_exv *vers)
{
- int ret;
int i;
struct utsname uval;
char *kver;
const char *cur_dist_name = NULL;
- if ((ret = tst_kvercmp(r1, r2, r3)))
- return ret;
-
uname(&uval);
kver = uval.release;
if (strstr(kver, ".el5")) {
@@ -96,7 +103,7 @@ int tst_kvercmp2(int r1, int r2, int r3, struct tst_kern_exv
*vers)
} else if (strstr(kver, ".el6")) {
cur_dist_name = "RHEL6";
} else {
- return ret;
+ return 0;
}
for (i = 0; vers[i].dist_name; i++) {
@@ -104,5 +111,5 @@ int tst_kvercmp2(int r1, int r2, int r3, struct
tst_kern_exv *vers)
return tst_kexvcmp(vers[i].extra_ver, kver);
}
- return ret;
+ return 0;
}
--
1.8.3.2.634.g7a3187e
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list