From owner-p4-projects@FreeBSD.ORG Thu Jun 28 09:07:40 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5BD4316A475; Thu, 28 Jun 2007 09:07:40 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3935716A41F for ; Thu, 28 Jun 2007 09:07:40 +0000 (UTC) (envelope-from zhouzhouyi@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 1103413C4AD for ; Thu, 28 Jun 2007 09:07:40 +0000 (UTC) (envelope-from zhouzhouyi@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l5S97duw028772 for ; Thu, 28 Jun 2007 09:07:39 GMT (envelope-from zhouzhouyi@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l5S97ddk028768 for perforce@freebsd.org; Thu, 28 Jun 2007 09:07:39 GMT (envelope-from zhouzhouyi@FreeBSD.org) Date: Thu, 28 Jun 2007 09:07:39 GMT Message-Id: <200706280907.l5S97ddk028768@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to zhouzhouyi@FreeBSD.org using -f From: Zhouyi ZHOU To: Perforce Change Reviews Cc: Subject: PERFORCE change 122465 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2007 09:07:40 -0000 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; }