Date: Thu, 28 Jun 2007 09:07:39 GMT From: Zhouyi ZHOU <zhouzhouyi@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 122465 for review Message-ID: <200706280907.l5S97ddk028768@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=122465 Change 122465 by zhouzhouyi@zhouzhouyi_mactest on 2007/06/28 09:07:38 Modify mactest.c so that matching rule can be more freely specified, for example "mls/low(low-high),biba/high(low-high)" can match "biba/high(low-high),mls/low(low-high)" Affected files ... .. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/mactest.c#4 edit Differences ... ==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/mactest.c#4 (text+ko) ==== @@ -517,38 +517,86 @@ return (i); } -static volatile int waitforsig = 1; + -static void sig_usr(int signo){ - waitforsig = 0; -} +/* compare modes_or_flags from mactest.conf and from /var/log/mactest, should be exact match + * and order appears in the sequence is irrelevance */ +static int modes_or_flags_compare(struct modes_or_flags * mf_conf, struct modes_or_flags *mf_log) +{ + struct modes_or_flags * tmp, *tmp1; -int modes_or_flags_compare(struct modes_or_flags * mf1, struct modes_or_flags *mf2){ - while (mf1) { - if (!mf2) + tmp = mf_conf; + while (tmp) { + tmp1 = mf_log; + if (!tmp1) + return 1; + while(tmp1) { + if (!strcmp(tmp->modflagname, tmp1->modflagname)) + break; + tmp1 = tmp1->next; + } + if (!tmp1) + return 1; + tmp = tmp->next; + } + + tmp = mf_log; + while (tmp) { + tmp1 = mf_conf; + if (!tmp1) + return 1; + while(tmp1) { + if (!strcmp(tmp->modflagname, tmp1->modflagname)) + break; + tmp1 = tmp1->next; + } + if (!tmp1) return 1; - if (strcmp(mf1->modflagname, mf2->modflagname)) + tmp = tmp->next; + } + + return 0; +} + +/* compare labelstrings from mactest.conf and from /var/log/mactest, should be exact match + * and order of the modules appears in a label is irrelevance */ +static label_compare(char *conf, char *log) +{ + + char *element_data, *element_data1, *element_data2, *tmp, *conf1, *tmp2; + if (!strcmp(conf, "*")) + return 0; + tmp2 = conf1 = strdup(conf); + while ((element_data = strsep(&conf1, ",")) != NULL) { + tmp = element_data1 = strdup(log); + while ((element_data2 = strsep(&element_data1, ",")) != NULL){ + if (!strcmp(element_data2, element_data)) + break; + } + if (element_data2 == NULL){ + free(tmp); + free(tmp2); return 1; - mf1 = mf1->next; - mf2 = mf2->next; + }else + free(tmp); } - if (mf2) - return 1; + free(tmp2); return 0; } +static int labelstrings_compare(struct labelstrings *ls_conf, struct labelstrings *ls_log) +{ -int labelstrings_compare(struct labelstrings *ls1, struct labelstrings *ls2){ - while (ls1) { - if (!ls2) + while (ls_conf) { + if (!ls_log) return 1; - if (strcmp(ls1->labelstring, ls2->labelstring)) + if (label_compare(ls_conf->labelstring, ls_log->labelstring)) return 1; - ls1 = ls1->next; - ls2 = ls2->next; + ls_conf = ls_conf->next; + ls_log = ls_log->next; } - if (ls2) + if (ls_log) return 1; return 0; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200706280907.l5S97ddk028768>