From: Cyril H. <su...@li...> - 2013-10-22 18:51:07
|
The branch, master, has been updated via b968712a8cce12862e24d0461b073eaabe9cd3aa (commit) from 705926d096f7a64c9d53efeb789288e25457d68f (commit) - Log ----------------------------------------------------------------- commit b968712a8cce12862e24d0461b073eaabe9cd3aa Author: Cyril Hrubis <ch...@su...> Date: Tue Oct 22 19:50:31 2013 +0200 misc: remove tcore testcase After a little bit of internet archeology and it seems that patch which introduced /proc/sys/kernel/core_dump_threads file never got accepted into mainline linux kernel. (I found some discussion about it around linux 2.4 and 2.5 development.) So it looks like this test was never working on mainline kernels. Reported-by: C Nandi <cc...@ya...> Signed-off-by: Cyril Hrubis <ch...@su...> ----------------------------------------------------------------------- Summary of changes: doc/testcases/misc.txt | 8 - runalltests.sh | 6 - runtest/tcore | 1 - testcases/misc/Makefile | 4 - testcases/misc/tcore_patch_test_suites/.gitignore | 1 - testcases/misc/tcore_patch_test_suites/Makefile | 36 ---- testcases/misc/tcore_patch_test_suites/tcore.c | 211 --------------------- testcases/misc/tcore_patch_test_suites/tcore.exp | 149 --------------- testcases/misc/tcore_patch_test_suites/tcore.sh | 144 -------------- 9 files changed, 0 insertions(+), 560 deletions(-) delete mode 100644 runtest/tcore delete mode 100644 testcases/misc/tcore_patch_test_suites/.gitignore delete mode 100644 testcases/misc/tcore_patch_test_suites/Makefile delete mode 100644 testcases/misc/tcore_patch_test_suites/tcore.c delete mode 100644 testcases/misc/tcore_patch_test_suites/tcore.exp delete mode 100755 testcases/misc/tcore_patch_test_suites/tcore.sh diff --git a/doc/testcases/misc.txt b/doc/testcases/misc.txt index 4568181..fff2598 100644 --- a/doc/testcases/misc.txt +++ b/doc/testcases/misc.txt @@ -121,11 +121,3 @@ ltp/testcases/misc/math/nextafter <\test_location> <\testname> -<testname=tcore_patch_test_suites> - <description> - Test suite for multi-thread core dump kernel patch. - <\description> - <test_location> - ltp/testcases/misc/tcore_patch_test_suites - <\test_location> -<\testname> diff --git a/runalltests.sh b/runalltests.sh index 45ea015..0c2c363 100755 --- a/runalltests.sh +++ b/runalltests.sh @@ -343,12 +343,6 @@ fi "${RUNLTP}" -f tpm_tools ## END => Test Series 7 ## -## The next one i plan to run is tcore_patch_test_suites -## START => Test Series 8 ## -"${RUNLTP}" -f tcore -## END => Test Series 8 ## - - ## The next one i plan to run is stress_cd tests ## START => Test Series 9 ## if [ $RUN_STRESS_CD -eq 1 ] diff --git a/runtest/tcore b/runtest/tcore deleted file mode 100644 index f9c8139..0000000 --- a/runtest/tcore +++ /dev/null @@ -1 +0,0 @@ -tcore01 tcore.sh diff --git a/testcases/misc/Makefile b/testcases/misc/Makefile index 2fcd649..d89cb9c 100644 --- a/testcases/misc/Makefile +++ b/testcases/misc/Makefile @@ -23,9 +23,5 @@ top_srcdir ?= ../.. -ifneq ($(WITH_EXPECT),yes) -FILTER_OUT_SUBDIRS := tcore_patch_test_suites -endif - include $(top_srcdir)/include/mk/env_pre.mk include $(top_srcdir)/include/mk/generic_trunk_target.mk diff --git a/testcases/misc/tcore_patch_test_suites/.gitignore b/testcases/misc/tcore_patch_test_suites/.gitignore deleted file mode 100644 index e47c402..0000000 --- a/testcases/misc/tcore_patch_test_suites/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/tcore diff --git a/testcases/misc/tcore_patch_test_suites/Makefile b/testcases/misc/tcore_patch_test_suites/Makefile deleted file mode 100644 index 85ec229..0000000 --- a/testcases/misc/tcore_patch_test_suites/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# -# misc/crash test suite Makefile. -# -# Copyright (C) 2009, Cisco Systems Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Garrett Cooper, July 2009 -# - -top_srcdir ?= ../../.. - -include $(top_srcdir)/include/mk/testcases.mk - -INSTALL_TARGETS := tcore.exp tcore.sh - -LDLIBS += -lm -lpthread - -MAKE_TARGETS := tcore - -#MODCFLAGS := -DLINUX -I$(prefix)/usr/src/linux/include -MODCFLAGS := -DLINUX - -include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/testcases/misc/tcore_patch_test_suites/tcore.c b/testcases/misc/tcore_patch_test_suites/tcore.c deleted file mode 100644 index 4578448..0000000 --- a/testcases/misc/tcore_patch_test_suites/tcore.c +++ /dev/null @@ -1,211 +0,0 @@ -/* - * - * Copyright (c) Min Guo <mi...@in...>., 2003 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -// Use gcc -o xmm xmm.c -pthread -lm to compile. -#include "test.h" -#include "usctest.h" - -/* Extern Global Variables */ -extern int tst_count; -extern char *TESTDIR; /* temporary dir created by tst_tmpdir() */ -/* Global Variables */ -char *TCID = "tcore"; /* test program identifier. */ - -#if defined __i386__ || defined(__x86_64__) -#include <stdio.h> -#include <sys/types.h> -#include <unistd.h> -#include <math.h> -#include <pthread.h> - -#define BUFFER_SIZE 16 - -int TST_TOTAL = 1; /* total number of tests in this file. */ - -/* Circular buffer of integers. */ - -struct prodcons { - int buffer[BUFFER_SIZE]; /* the actual data */ - pthread_mutex_t lock; /* mutex ensuring exclusive access to buffer */ - int readpos, writepos; /* positions for reading and writing */ - pthread_cond_t notempty; /* signaled when buffer is not empty */ - pthread_cond_t notfull; /* signaled when buffer is not full */ -}; - -/* Initialize a buffer */ -static void init(struct prodcons *b) -{ - pthread_mutex_init(&b->lock, NULL); - pthread_cond_init(&b->notempty, NULL); - pthread_cond_init(&b->notfull, NULL); - b->readpos = 0; - b->writepos = 0; -} - -/* Store an integer in the buffer */ -static void put(struct prodcons *b, int data) -{ - pthread_mutex_lock(&b->lock); - /* Wait until buffer is not full */ - while ((b->writepos + 1) % BUFFER_SIZE == b->readpos) { - pthread_cond_wait(&b->notfull, &b->lock); - /* pthread_cond_wait reacquired b->lock before returning */ - } - /* Write the data and advance write pointer */ - b->buffer[b->writepos] = data; - b->writepos++; - if (b->writepos >= BUFFER_SIZE) - b->writepos = 0; - /* Signal that the buffer is now not empty */ - pthread_cond_signal(&b->notempty); - pthread_mutex_unlock(&b->lock); -} - -/* Read and remove an integer from the buffer */ -static int get(struct prodcons *b) -{ - int data; - pthread_mutex_lock(&b->lock); - /* Wait until buffer is not empty */ - while (b->writepos == b->readpos) { - pthread_cond_wait(&b->notempty, &b->lock); - } - /* Read the data and advance read pointer */ - data = b->buffer[b->readpos]; - b->readpos++; - if (b->readpos >= BUFFER_SIZE) - b->readpos = 0; - /* Signal that the buffer is now not full */ - pthread_cond_signal(&b->notfull); - pthread_mutex_unlock(&b->lock); - return data; -} - -/* A test program: one thread inserts integers from 1 to 10000, - the other reads them and prints them. */ - -#define OVER (-1) - -struct prodcons buffer; - -static void *producer(void *data) -{ - int n; - pid_t pid; - long double a3 = 100.5678943, b3 = 200.578435698; - long double c3, d3, e3, f3; - a3 += b3; - a3 *= pow(b3, 2); - pid = getpid(); - tst_resm(TINFO, "producer pid=%d", pid); - sleep(1); - for (n = 0; n < 10000; n++) { - tst_resm(TINFO, "%d --->", n); - put(&buffer, n); - - if (n == 7686) { - system("ps ax | grep ex"); - c3 = pow(pid, pid); - d3 = log(pid); - e3 = c3 * d3; - f3 = c3 / d3; - { - char buf[16]; - sprintf(buf, "%d%d\n", pid, pid); - asm volatile ("movups (%0), %%xmm1;":: - "r" (buf):"memory"); - } - sleep(1); - } - } - put(&buffer, OVER); - return NULL; -} - -static void *consumer(void *data) -{ - int d; - char *junk = NULL; - pid_t pid; - long double a2 = 10002.5, b2 = 2888883.5; - long double d2, e2, f2; - a2 += b2; - pid = getpid(); - tst_resm(TINFO, "consumer pid=%d", pid); - sleep(1); - while (1) { - d = get(&buffer); - if (d == OVER) - break; - tst_resm(TINFO, "---> %d", d); - if (d == 7688) { - system("ps ax | grep ex"); - d2 = pid * a2 / b2; - e2 = tan(pid); - f2 = cos(pid) / d2; - { - char buf[16]; - char buf1[16]; - sprintf(buf, "%d%d\n", pid, pid); - sprintf(buf1, "%Lf", d2); - asm volatile ("movups (%0), %%xmm2;":: - "r" (buf):"memory"); - asm volatile ("movups (%0), %%xmm5;":: - "r" (buf):"memory"); - } - *junk = 0; - } - } - return NULL; -} - -int main(void) -{ - pthread_t th_a, th_b; - void *retval; - double a1 = 1.5, b1 = 2.5; - long double c1; - pid_t pid; - a1 += b1; - - pid = getpid(); - - init(&buffer); - /* Create the threads */ - pthread_create(&th_a, NULL, producer, 0); - pthread_create(&th_b, NULL, consumer, 0); - - c1 = exp(pid); - /* Wait until producer and consumer finish. */ - pthread_join(th_a, &retval); - pthread_join(th_b, &retval); - return 0; -} - -#else /* Not __i386__ */ - -int TST_TOTAL = 0; /* Total number of test cases. */ - -int main() -{ - tst_resm(TCONF, "tcore only works on x86 systems ..."); - tst_exit(); -} - -#endif /* __i386__ */ diff --git a/testcases/misc/tcore_patch_test_suites/tcore.exp b/testcases/misc/tcore_patch_test_suites/tcore.exp deleted file mode 100644 index 1a60dcc..0000000 --- a/testcases/misc/tcore_patch_test_suites/tcore.exp +++ /dev/null @@ -1,149 +0,0 @@ -#!/usr/bin/expect -- - -# Copyright (c) Guo Min <mi...@in...>., 2002 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See -# the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -set curr_thread 0 -set pass 0 -proc check_buf {buf key} { - set num 0 - for {} 1 {} { - set split_buf [split $buf ""] - set i [string first "\n" $buf] - if $i==-1 break; - set line [join [lrange $split_buf 0 $i] ""] - set buf [join [lrange $split_buf [expr 1+$i] end] ""] - set i [lsearch $line $key] - if -1!=$i { - incr num - } - } - return $num -} -proc check_threads {} { - global curr_thread - global pass - set istrue 0 - send "info threads\n" - expect { - -re " \[0-9\]+ process .*(gdb)" { - set buf $expect_out(0,string) - } - timeout { - puts stderr "timeout while run info threads" - return 1 - } - } - set curr_thread [check_buf $buf "process"] - if { $curr_thread == 0 } { - send_user "check_threads (no current thread)\n" - return 1 - } - if { $curr_thread >= 1 } { - set pass [expr $pass + 1] - send_user "the core dump includes multi thread information\n" - return 0 - } -} - -proc check_bt {} { - global curr_thread - global pass - set test 0 - set counter 1 - while { $counter <= $curr_thread } { - send "\n" - send "thread $counter\n" - expect { - -re "Switching to thread $counter .*\n" { - set buf $expect_out(0,string) - } - timeout { - send_user "timeout "; - return 1 - } - } - set number1 [check_buf $buf "(process"] - send "bt\n" - expect { - -re " bt.*#\[0-9\]+ .*(gdb)" { - set buf $expect_out(0,string) - } - } - set number [check_buf $buf "in"] - if { $number < 1 } { - set test 1 - } - set counter [expr $counter + 1] - } - if { 0 == $test } { - set pass [expr $pass + 1] - send_user "check bt in coredump successfully" - return 0 - } else { - send_user "check bt in coredump incorrectly" - return 1 - } - return 0 -} - -proc check_fpu {num} { - global expect_out - global pass - send "\n" - send "info register\n" - send "\n" - expect { - -re "xmm$num\[\t \]+\{f \= .*\}+\[\t \]+\{f \= .*\}" { - set buf $expect_out(0,string) - } - timeout { - puts stderr "fail to check the xmm value(timeout)" - return 1 - } - } - send "quit\n" - set buf_tmp [split $buf "\{"] - set buf1 [lindex $buf_tmp 4] - set buf2 [split $buf1 ","] - set number [lindex $buf2 1] - if { 0 != $number } { - set pass [expr $pass + 1] - send_user "success while check whether core dump includes fpu information" - return 0 - } else { - send_user "fail while check whether core dump includes fpu information" - return 1 - } -} -set GDB gdb -set binfile ./tcore -set corefile ./corefile - -spawn $GDB ${binfile} ${corefile} -check_fpu 5 -send "quit\n" - -spawn $GDB ${binfile} ${corefile} -check_threads -send "quit\n" - - -spawn $GDB ${binfile} ${corefile} -check_bt -send "quit\n" -exit $pass - diff --git a/testcases/misc/tcore_patch_test_suites/tcore.sh b/testcases/misc/tcore_patch_test_suites/tcore.sh deleted file mode 100755 index aad2b6b..0000000 --- a/testcases/misc/tcore_patch_test_suites/tcore.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/sh - -# Copyright (c) Guo Min <mi...@in...>., 2002 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See -# the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -# Test suite for the t-core kernel patch -export TCID=tcore01 -PTHREAD_DIR="/lib/i686" -BIN_DIR=$LTPROOT/testcases/bin/ -TEST_DIR=$(mktemp -dt) -OSTYPE="redhat" -# Do some preparation to generate the correct core dump -# files -pass=0 -fail=0 -check_install() -{ - if [ -f /proc/sys/kernel/core_dumps_threads ];then - pass=`expr $pass + 1` - return 0 - else - fail=`expr $fail + 1` - return 1 - fi -} -os_check() -{ - if [ -d /usr/src/hardhat ];then - OSTYPE="hardhat" - fi -} - -cleanup() -{ - rm -rf $TEST_DIR - [ -f /proc/sys/kernel/core_dumps_threads ] && ! [ -z "$OLD_PATTERN" ] && - echo "$OLD_PATTERN" > /proc/sys/kernel/core_dumps_threads - exit $1 -} - -prepare_dump() -{ - ulimit -c 20000000 >/dev/null 2>&1 - # Open the core_dumps_threads key - if [ -f /proc/sys/kernel/core_dumps_threads ];then - m=`cat /proc/sys/kernel/core_dumps_threads` - if [ $m -eq 0 ];then - echo "1">/proc/sys/kernel/core_dumps_threads - fi - fi - if [ -f /proc/sys/kernel/core_pattern ]; then - OLD_PATTERN=$(cat /proc/sys/kernel/core_pattern) - echo 'core.%p' > /proc/sys/kernel/core_pattern - fi - #Recover the lipthread.so.0 lib to generate the correct - #core dump file - os_check - if [ $OSTYPE = "redhat" ];then - cd $PTHREAD_DIR && { - if [ -f libpthread.so.0.orig ];then - test=`ls -l libpthread.so.0.orig|awk '{print $11}'` - if [ $test = "libpthread-0.9.so" ];then - mv libpthread.so.0.orig libpthread.so.0 - fi - fi - cd - - } - fi -} -#Prepare for the gdb dump -prepare_gdb() -{ - os_check - if [ $OSTYPE = "redhat" ];then - cd $PTHREAD_DIR && { - if [ -f libpthread.so.0 ];then - test=`ls -l libpthread.so.0|awk '{print $11}'` - if [ $test = "libpthread-0.9.so" ];then - mv libpthread.so.0 libpthread.so.0.orig - fi - fi - ln -s /lib/libpthread.so.0 libpthread.so.0 >/dev/null 2>&1 - cd - - } - fi -} -#Test whether the system can generate the needed core files -#The core files should has pid as its extension -Test_gen_core() -{ - cd $TEST_DIR - prepare_dump - if [ -f core.* ];then - rm -f core.* - fi - pid=`$BIN_DIR/tcore |grep "consumer pid"|awk '{print $2}'|cut -d = -f 2` - echo "Test whether we can generate the needed core file" - if [ -f core.* ];then - echo "PASS" - pass=`expr $pass + 1` - return 0 - else - echo "FAIL" - fail=`expr $fail + 1` - return 1 - fi -} - -Test_core_file() -{ - cd $TEST_DIR - prepare_gdb - mv -f $TEST_DIR/core.* $TEST_DIR/corefile >/dev/null 2>&1 - echo "Test whether the core support bt,fpu and threads commands " - expect $BIN_DIR/tcore.exp - return=$? - pass=`expr $pass + $return` - fail=`expr 3 - $return + $fail` -} - -echo "Test Tcore patch " -check_install -Test_gen_core -Test_core_file -echo "Linux Tcore test results" > results -echo "Total pass fail" >> results -echo " 5 $pass $fail" >> results -cleanup $fail - - - hooks/post-receive -- ltp |