From owner-svn-src-all@FreeBSD.ORG Fri Nov 20 18:53:38 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8A88106575D; Fri, 20 Nov 2009 18:53:38 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A6CC38FC0A; Fri, 20 Nov 2009 18:53:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAKIrc6G053225; Fri, 20 Nov 2009 18:53:38 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAKIrcoZ053217; Fri, 20 Nov 2009 18:53:38 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <200911201853.nAKIrcoZ053217@svn.freebsd.org> From: Jung-uk Kim Date: Fri, 20 Nov 2009 18:53:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199604 - in head/tools/regression/bpf/bpf_filter: . tests X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Nov 2009 18:53:38 -0000 Author: jkim Date: Fri Nov 20 18:53:38 2009 New Revision: 199604 URL: http://svn.freebsd.org/changeset/base/199604 Log: Adjust BPF JIT compiler regression tests to catch up with r199603. Modified: head/tools/regression/bpf/bpf_filter/Makefile head/tools/regression/bpf/bpf_filter/bpf_test.c head/tools/regression/bpf/bpf_filter/tests/test0075.h head/tools/regression/bpf/bpf_filter/tests/test0076.h head/tools/regression/bpf/bpf_filter/tests/test0077.h head/tools/regression/bpf/bpf_filter/tests/test0078.h head/tools/regression/bpf/bpf_filter/tests/test0080.h Modified: head/tools/regression/bpf/bpf_filter/Makefile ============================================================================== --- head/tools/regression/bpf/bpf_filter/Makefile Fri Nov 20 18:49:20 2009 (r199603) +++ head/tools/regression/bpf/bpf_filter/Makefile Fri Nov 20 18:53:38 2009 (r199604) @@ -43,6 +43,7 @@ CFLAGS+= -DBPF_VALIDATE SRCS+= ${SYSDIR}/net/bpf_jitter.c \ ${SYSDIR}/${MACHINE_ARCH}/${MACHINE_ARCH}/bpf_jit_machdep.c CFLAGS+= -DBPF_JIT_COMPILER +LIBS+= -lutil WARNS?= 6 .else SRCS+= ${SYSDIR}/net/bpf_filter.c @@ -52,7 +53,7 @@ WARNS?= 2 .for TEST in ${TEST_CASES} ${TEST}: ${.CURDIR}/tests/${TEST}.h ${SRCS} @${CC} ${CFLAGS} -DBPF_TEST_H=\"${TEST}.h\" \ - -o ${.CURDIR}/${TEST} ${SRCS} + -o ${.CURDIR}/${TEST} ${SRCS} ${LIBS} .endfor all: ${TEST_CASES} Modified: head/tools/regression/bpf/bpf_filter/bpf_test.c ============================================================================== --- head/tools/regression/bpf/bpf_filter/bpf_test.c Fri Nov 20 18:49:20 2009 (r199603) +++ head/tools/regression/bpf/bpf_filter/bpf_test.c Fri Nov 20 18:53:38 2009 (r199604) @@ -1,5 +1,5 @@ /*- - * Copyright (C) 2008 Jung-uk Kim . All rights reserved. + * Copyright (C) 2009 Jung-uk Kim . All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -57,6 +57,8 @@ static int verbose = LOG_LEVEL; #ifdef BPF_JIT_COMPILER +#include + #include static u_int @@ -73,6 +75,10 @@ bpf_compile_and_filter(void) printf("FATAL\n"); exit(FATAL); } + if (verbose > 2) { + printf("\n"); + hexdump(filter->func, filter->size, NULL, HD_OMIT_CHARS); + } for (i = 0; i < BPF_NRUNS; i++) ret = (*(filter->func))(pkt, wirelen, buflen); @@ -222,6 +228,14 @@ main(void) for (i = 0; i < BPF_NRUNS; i++) ret = bpf_filter(nins != 0 ? pc : NULL, pkt, wirelen, buflen); #endif + if (expect_signal != 0) { + if (verbose > 1) + printf("Expected signal %d but got none:\t", + expect_signal); + if (verbose > 0) + printf("FAILED\n"); + return (FAILED); + } if (ret != expect) { if (verbose > 1) printf("Expected 0x%x but got 0x%x:\t", expect, ret); Modified: head/tools/regression/bpf/bpf_filter/tests/test0075.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0075.h Fri Nov 20 18:49:20 2009 (r199603) +++ head/tools/regression/bpf/bpf_filter/tests/test0075.h Fri Nov 20 18:53:38 2009 (r199604) @@ -7,7 +7,7 @@ /* BPF program */ struct bpf_insn pc[] = { BPF_STMT(BPF_LD+BPF_IMM, 0xdeadc0de), - BPF_STMT(BPF_LD+BPF_MEM, 0xffffffff), + BPF_STMT(BPF_LD+BPF_MEM, 0x8fffffff), BPF_STMT(BPF_RET+BPF_A, 0), }; @@ -29,8 +29,8 @@ int invalid = 1; u_int expect = 0xdeadc0de; /* Expected signal */ -#ifdef BPF_JIT_COMPILER -int expect_signal = SIGSEGV; -#else +#ifdef __amd64__ int expect_signal = SIGBUS; +#else +int expect_signal = SIGSEGV; #endif Modified: head/tools/regression/bpf/bpf_filter/tests/test0076.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0076.h Fri Nov 20 18:49:20 2009 (r199603) +++ head/tools/regression/bpf/bpf_filter/tests/test0076.h Fri Nov 20 18:53:38 2009 (r199604) @@ -7,7 +7,7 @@ /* BPF program */ struct bpf_insn pc[] = { BPF_STMT(BPF_LD+BPF_IMM, 0xdeadc0de), - BPF_STMT(BPF_LDX+BPF_MEM, 0xffffffff), + BPF_STMT(BPF_LDX+BPF_MEM, 0x8fffffff), BPF_STMT(BPF_MISC+BPF_TXA, 0), BPF_STMT(BPF_RET+BPF_A, 0), }; @@ -30,8 +30,8 @@ int invalid = 1; u_int expect = 0xdeadc0de; /* Expected signal */ -#ifdef BPF_JIT_COMPILER -int expect_signal = SIGSEGV; -#else +#ifdef __amd64__ int expect_signal = SIGBUS; +#else +int expect_signal = SIGSEGV; #endif Modified: head/tools/regression/bpf/bpf_filter/tests/test0077.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0077.h Fri Nov 20 18:49:20 2009 (r199603) +++ head/tools/regression/bpf/bpf_filter/tests/test0077.h Fri Nov 20 18:53:38 2009 (r199604) @@ -7,7 +7,7 @@ /* BPF program */ struct bpf_insn pc[] = { BPF_STMT(BPF_LD+BPF_IMM, 0xdeadc0de), - BPF_STMT(BPF_ST, 0xffffffff), + BPF_STMT(BPF_ST, 0x8fffffff), BPF_STMT(BPF_RET+BPF_A, 0), }; @@ -29,8 +29,8 @@ int invalid = 1; u_int expect = 0xdeadc0de; /* Expected signal */ -#ifdef BPF_JIT_COMPILER -int expect_signal = SIGSEGV; -#else +#ifdef __amd64__ int expect_signal = SIGBUS; +#else +int expect_signal = SIGSEGV; #endif Modified: head/tools/regression/bpf/bpf_filter/tests/test0078.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0078.h Fri Nov 20 18:49:20 2009 (r199603) +++ head/tools/regression/bpf/bpf_filter/tests/test0078.h Fri Nov 20 18:53:38 2009 (r199604) @@ -7,7 +7,7 @@ /* BPF program */ struct bpf_insn pc[] = { BPF_STMT(BPF_LD+BPF_IMM, 0xdeadc0de), - BPF_STMT(BPF_STX, 0xffffffff), + BPF_STMT(BPF_STX, 0x8fffffff), BPF_STMT(BPF_MISC+BPF_TXA, 0), BPF_STMT(BPF_RET+BPF_A, 0), }; @@ -30,8 +30,8 @@ int invalid = 1; u_int expect = 0xdeadc0de; /* Expected signal */ -#ifdef BPF_JIT_COMPILER -int expect_signal = SIGSEGV; -#else +#ifdef __amd64__ int expect_signal = SIGBUS; +#else +int expect_signal = SIGSEGV; #endif Modified: head/tools/regression/bpf/bpf_filter/tests/test0080.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0080.h Fri Nov 20 18:49:20 2009 (r199603) +++ head/tools/regression/bpf/bpf_filter/tests/test0080.h Fri Nov 20 18:53:38 2009 (r199604) @@ -1,12 +1,12 @@ /*- - * Test 0080: Check uninitialized scratch memory (only for JIT compiler). + * Test 0080: Check uninitialized scratch memory (obsolete). * * $FreeBSD$ */ /* BPF program */ struct bpf_insn pc[] = { -#ifdef BPF_JIT_COMPILER +#ifdef BPF_JIT_COMPILER_OBSOLETE BPF_STMT(BPF_LDX+BPF_IMM, 0xffffffff), BPF_STMT(BPF_LD+BPF_MEM, 0), BPF_JUMP(BPF_JMP+BPF_JSET+BPF_X, 0, 29, 0),