From 15d60a2ede8521ffdc6645b427ebb8b43d91b2d9 Mon Sep 17 00:00:00 2001 From: Jiri Palecek Date: Sun, 23 Nov 2008 23:50:08 +0100 Subject: [PATCH] Delete the scratch subdirectory, we don't need it --- .gbp.conf | 2 +- scratch/cache_leak | 174 --------------- scratch/googlemmtest.txt | 269 ----------------------- scratch/hackbench.c | 261 ----------------------- scratch/lat-sched.c | 346 ------------------------------ scratch/runltp.orig | 541 ----------------------------------------------- scratch/runltp.robbie | 413 ------------------------------------ 7 files changed, 1 insertion(+), 2005 deletions(-) delete mode 100644 scratch/cache_leak delete mode 100644 scratch/googlemmtest.txt delete mode 100644 scratch/hackbench.c delete mode 100644 scratch/lat-sched.c delete mode 100755 scratch/runltp.orig delete mode 100755 scratch/runltp.robbie diff --git a/.gbp.conf b/.gbp.conf index 16b4207c..c538422e 100644 --- a/.gbp.conf +++ b/.gbp.conf @@ -33,7 +33,7 @@ upstream-branch = dfsg_clean [git-import-orig] #upstream-branch = newupstream debian-branch = dfsg_clean -filter = [ 'autom4te.cache', 'config.guess', 'config.log', 'config.status', 'config.guess', 'config.sub', 'testcases/ballista/ballista/perllib/*', 'libevent', 'pcllib', 'epoll2', 'lex.yy.c', 'bparser', 'blexer', '*.o', 'mut.out', 'linux_syscall_numbers.h', '*~', 'testcases/ballista/ballista/outfiles/*', 'testcases/ballista/ballista/callInclude.cpp', 'testcases/ballista/ballista/callTable', 'testcases/ballista/ballista/comp.txt', 'testcases/ballista/ballista/dataTypes', 'testcases/ballista/ballista/executeTestCase.cpp', 'testcases/ballista/ballista/executeTestCase.h', 'testcases/ballista/ballista/mut', 'testcases/ballista/ballista/userIncludes.h', 'testcases/ballista/ballista/vardefs.cpp', 'testcases/ballista/ballista/do_parse' ] +filter = [ 'autom4te.cache', 'config.guess', 'config.log', 'config.status', 'config.guess', 'config.sub', 'testcases/ballista/ballista/perllib/*', 'libevent', 'pcllib', 'epoll2', 'lex.yy.c', 'bparser', 'blexer', '*.o', 'mut.out', 'linux_syscall_numbers.h', '*~', 'testcases/ballista/ballista/outfiles/*', 'testcases/ballista/ballista/callInclude.cpp', 'testcases/ballista/ballista/callTable', 'testcases/ballista/ballista/comp.txt', 'testcases/ballista/ballista/dataTypes', 'testcases/ballista/ballista/executeTestCase.cpp', 'testcases/ballista/ballista/executeTestCase.h', 'testcases/ballista/ballista/mut', 'testcases/ballista/ballista/userIncludes.h', 'testcases/ballista/ballista/vardefs.cpp', 'testcases/ballista/ballista/do_parse', 'scratch' ] no-dch = True # Options only affecting git-import-dsc diff --git a/scratch/cache_leak b/scratch/cache_leak deleted file mode 100644 index 811640d0..00000000 --- a/scratch/cache_leak +++ /dev/null @@ -1,174 +0,0 @@ -From linux-kernel-owner@vger.kernel.org Tue Jan 8 20:59:05 2002 -Message-Id: <200201090245.g092jnt02235@mysql.sashanet.com> -Content-Type: text/plain; - charset="us-ascii" -From: Sasha Pachev -Organization: MySQL -To: linux-kernel@vger.kernel.org -Subject: Test case for cache leak in 2.17.2-rc2 -Date: Tue, 8 Jan 2002 19:45:49 -0700 -X-Mailer: KMail [version 1.3.1] -MIME-Version: 1.0 -Content-Transfer-Encoding: 8bit -Sender: linux-kernel-owner@vger.kernel.org -Precedence: bulk -X-Mailing-List: linux-kernel@vger.kernel.org -Status: RO -Content-Length: 3887 - -The following test program demonstrates incorrect cache shrinking logic in -2.17.2-rc2 with 0 swap. I suspect the same problem will happen if swap is not -zero but is filled up. I have not noticed anything relevant in the changelogs -between my version and 2.4.18-pre2, so I assume the bug is still there. It -would be nice if somebody could verify it. - -First the code: - --------------------start--------------------- -#include -#include -#include -#include - -#define BLOCK_SIZE 1024 - -int done_hog_cache=0; -int done_hog_free=0; -int go_pipe[2]; -pid_t child_pid=0; - -void stop_hog_cache() -{ - done_hog_cache=1; -} - -void stop_hog_free() -{ - done_hog_free=1; -} - -void stop_all() -{ - done_hog_free=done_hog_cache=1; - if (child_pid>0) - kill(child_pid,SIGHUP); -} - -void hog_free(int blocks) -{ - char* buf; - char go_buf[2]; - - signal(SIGHUP,stop_hog_free); - signal(SIGTERM,stop_hog_free); - printf("Hogging free mem, to stop, do kill -HUP %d in another terminal\n", - getpid()); - read(go_pipe[0],go_buf,2); - if (!(buf=(char*)malloc(blocks*BLOCK_SIZE))) - { - fprintf(stderr,"malloc() failed\n"); - exit(1); - } - memset(buf,0xff,blocks*BLOCK_SIZE); - while (!done_hog_free) - { - sleep(1); - } -} - -void hog_cache(int blocks) -{ - FILE* fp; - char buf[BLOCK_SIZE]; - const char* hog_file="/tmp/hog-file"; - int i; - - memset(buf,0xff,sizeof(buf)); - if (!(fp=fopen(hog_file,"w+"))) - { - fprintf(stderr,"Could not open crash file\n"); - exit(1); - } - signal(SIGHUP,stop_hog_cache); - signal(SIGTERM,stop_hog_free); - printf("Hogging disk cache, to stop, do kill -HUP %d in another terminal\n", - getpid()); - for (i=0;i - / /|_/ / // /\ \/ /_/ / /__ MySQL AB, http://www.mysql.com/ -/_/ /_/\_, /___/\___\_\___/ Provo, Utah, USA - <___/ -- -To unsubscribe from this list: send the line "unsubscribe linux-kernel" in -the body of a message to majordomo@vger.kernel.org -More majordomo info at http://vger.kernel.org/majordomo-info.html -Please read the FAQ at http://www.tux.org/lkml/ - - diff --git a/scratch/googlemmtest.txt b/scratch/googlemmtest.txt deleted file mode 100644 index a4b77e3d..00000000 --- a/scratch/googlemmtest.txt +++ /dev/null @@ -1,269 +0,0 @@ -From linux-kernel-owner@vger.kernel.org Tue Oct 30 17:11:46 2001 -Received: from sgi.com (sgi.engr.sgi.com [192.26.80.37]) by tulip-e185.americas.sgi.com (980427.SGI.8.8.8/SGI-server-1.7) with ESMTP id RAA38308; Tue, 30 Oct 2001 17:11:46 -0600 (CST) -Received: from vger.kernel.org ([199.183.24.194]) - by sgi.com (980327.SGI.8.8.8-aspam/980304.SGI-aspam: - SGI does not authorize the use of its proprietary - systems or networks for unsolicited or bulk email - from the Internet.) - via ESMTP id PAA04932; Tue, 30 Oct 2001 15:11:45 -0800 (PST) - mail_from (linux-kernel-owner@vger.kernel.org) -Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand - id ; Tue, 30 Oct 2001 18:06:04 -0500 -Received: (majordomo@vger.kernel.org) by vger.kernel.org - id ; Tue, 30 Oct 2001 18:05:56 -0500 -Received: from dsl-213-023-043-203.arcor-ip.net ([213.23.43.203]:42764 "EHLO - starship.berlin") by vger.kernel.org with ESMTP id ; - Tue, 30 Oct 2001 18:05:42 -0500 -Received: from daniel by starship.berlin with local (Exim 3.32 #1 (Debian)) - id 15yhyY-0000Yb-00; Wed, 31 Oct 2001 00:07:18 +0100 -Content-Type: text/plain; charset=US-ASCII -From: Daniel Phillips -To: linux-kernel@vger.kernel.org -Subject: Google's mm problems -Date: Wed, 31 Oct 2001 00:07:17 +0100 -X-Mailer: KMail [version 1.3.2] -Cc: Rik van Riel , Andrea Arcangeli -MIME-Version: 1.0 -Content-Transfer-Encoding: 7BIT -Message-Id: -Sender: linux-kernel-owner@vger.kernel.org -Precedence: bulk -X-Mailing-List: linux-kernel@vger.kernel.org -Status: RO -Content-Length: 10198 - -Hi, I've been taking a look on a mm problem that Ben Smith of Google posted -a couple of weeks ago. As it stands, Google can't use 2.4 yet because all -known flavors of 2.4 mm fall down in one way or another. This is not good. - -The kernel that comes closest to working is 2.4.9. After running the test -application below for about 30 seconds, kswapd takes over and cpu utilization -goes to 100%. With a dual processor system the system remains usable -(because kswapd can't take over two cpus at the same time, however much it -would like to). The test application does run to completion, taking about -20% more real time and 95% more cpu than it should. - -Other kernels show worse behaviour. Ben has checked them, I haven't yet. -Ben reports that they all lock up so that applications make no progress, -except for linux-2.4.13-ac4 which locks up with 3.5G but not with 2G. -According to Ben, the linus kernels after 2.4.9 (Andrea) lock up hard so that -power cycling is required, while control can be recovered on -ac (Rik) -kernels eventually by killing the application. - -I took a look at this and was able to reproduce the problem easily on a 2.4.9 -kernel, dual cpu, 2 Gig memory, using a procedure described below. - -The application, written by Ben, goes through a loop mmaping a number of -large files, in this case 2 (with 2 Gig) and mlocking them. So the effect is -to allocate a lot of memory and free it. This works fine until free memory -runs out and freeable memory has to start being recycled. After a while, -most memory ends up on the active list and kswapd cpu utilization hits 100%. - -Earlier, Andrea suggested trying madvise instead of mlock, and the results -are pretty much the same. (Which could be a clue.) - -I found that the first obvious problem is, kswapd is never sleeping. I was -able to reduce cpu utilization to 35% easily by ignoring the result of -try_to_free_pages in kswapd, so that kswapd always sleeps after doing its -work. This sort of makes sense anyway, since in a heavily loaded state the -synchronous mm scanning does just as good a job as kswapd, and unlike -kswapd, does terminate after a known amount of scanning. This trivial -change change is obviously just a bandaid. - -I've run out of time to work on this just now since I have to get ready for -ALS. The next step is to find out why kernels other than 2.4.9 have trouble -with this application. This includes both Rik and Andrea mm variants. So -I'm posting my results so far and a method for reproducing the problems. - -The application uses a little over 8 Gig of test data on disk, created by -the following bash script: - - for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19; - do dd if=/dev/zero of=/test/chunk$i count=6682555 bs=64; done - -The following c++ application runs with no parameters: - -#include -#include -#include -#include -#include -#include -#include -#include - -#define BLOCK_SIZE 427683520 -// Adjust NUM_BLOCKS as needed to ensure that mlock won't fail -#define NUM_BLOCKS 6 -// Sometimes when mmap fails at the default address it will succed here -#define ALT_ADDR 0x0d000000 -// We lock with 1M chunks to avoid machine lockups. -#define MLOCK_CHUNK 1048576 -#define PAGE_SIZE 4096 -char *addrs[NUM_BLOCKS]; -const char *filepat = "/test/chunk%d"; -static int num_slots; - -void mlock_slot(int i) { - timeval start, end; - gettimeofday(&start, NULL); - char *top = addrs[i] + BLOCK_SIZE; - printf("mlocking slot %i, %x\n", i, addrs[i]); - for (char* addr = addrs[i]; addr < top; - addr += MLOCK_CHUNK) { - int size = addr + MLOCK_CHUNK <= top ? - MLOCK_CHUNK : top - addr; - if (addr == addrs[i]) - printf("mlocking at %x of size %d\n", addr, MLOCK_CHUNK); - if (mlock(addr, size) == -1) { - printf("mlock failed: %s\n", strerror(errno)); - abort(); - } else { - // printf("mlock succeeded\n"); - } - } - gettimeofday(&end, NULL); - long elapsed_usec = (end.tv_sec - start.tv_sec) * 1000000 + - (end.tv_usec - start.tv_usec); - printf("mlock took %lf seconds\n", elapsed_usec / 1000000.0); -} - -int main() { - - // First we setup our regions - for (int i = 0; i < NUM_BLOCKS; ++i) { - printf("mmap'ing %d bytes...\n", BLOCK_SIZE); - addrs[i] = (char*)mmap(0, BLOCK_SIZE, PROT_READ, MAP_PRIVATE|MAP_ANON, - -1, 0); - if (addrs[i] == MAP_FAILED) { - printf("mmap failed: %s\n", strerror(errno)); - printf("trying backup region %x\n", ALT_ADDR); - addrs[i] = (char*)mmap((char *)ALT_ADDR, BLOCK_SIZE, PROT_READ, - MAP_PRIVATE|MAP_ANON, -1, 0); - if (addrs[i] == MAP_FAILED) - printf("backup mmap failed: %s\n", strerror(errno)); - } - if (addrs[i] != MAP_FAILED) - printf("mmap'ed at %x-%x.\n", addrs[i], (int)addrs[i] + BLOCK_SIZE); - if (mlock(addrs[i], BLOCK_SIZE) < 0) { - printf("mlock of slot %d failed, using only %d slots\n", i, num_slots); - munmap(addrs[i], BLOCK_SIZE); - addrs[i] = (char *)MAP_FAILED; - break; - } - num_slots++; - } - - // Okay, let's load over the old blocks - for (int j = 0; j < 20; ++j) { - int i = j % num_slots; - if (addrs[i] == MAP_FAILED) - break; - if ( munlock(addrs[i], BLOCK_SIZE) < 0 ) - printf("Error munlock'ing %x\n", addrs[i]); - else - printf("munlock'ed %x\n", addrs[i]); - if ( munmap(addrs[i], BLOCK_SIZE) < 0 ) - printf("Error munmap'ing region %x\n", addrs[i]); - else - printf("munmap'ed %x\n", addrs[i]); - printf("Loading data at %x for slot %i\n", addrs[i], i); - char filename[1024]; - sprintf(filename, filepat, j); - int fd = open(filename, O_RDONLY); - if (fd < 0) abort(); - char *addr = (char*)mmap(addrs[i], BLOCK_SIZE, PROT_READ, - MAP_FIXED | MAP_PRIVATE, fd, 0); - if (addr != addrs[i] || addr == MAP_FAILED) { - printf("Load failed: %s\n", strerror(errno)); - } else { - printf("Load (%s) succeeded!\n", filename); - } - mlock_slot(i); - close(fd); - } - printf("sleeping...\n"); - while(1) sleep(5); -} - -If it works flawlessly it will complete its work in about 20 X 18 seconds = 6 -minutes, then sleep. On 2.4.9 it gets bogged down in kswapd after about 30 -seconds as soon as the program has eaten its way through all the 'virgin' -memory and memory starts to be recycled. This causes it to take about 10 -minutes to complete, and kswapd usage stays at 100% when the program sleeps. - -On a subsequent run, the application will drive kswapd to 100% cpu -immediately, which is understandable because 99% of memory remains in cache. -This cache memory can be freed by putting the /test/ directory on a separate -partition and umounting it, which restores the system to a relatively -pristine state. - -Profiling the kernel shows me that the cpu hogs are refill_inactive_scan, -page_launder, and pagemap_lru_lock contention, in that order. I suspected -that kswapd is never sleeping, so I applied this patch: - ---- ../2.4.9.clean/mm/vmscan.c Wed Aug 15 05:37:07 2001 -+++ ./mm/vmscan.c Tue Oct 30 16:15:52 2001 -@@ -927,7 +927,7 @@ - recalculate_vm_stats(); - } - -- if (!do_try_to_free_pages(GFP_KSWAPD, 1)) { -+ if (!do_try_to_free_pages(GFP_KSWAPD, 1) && 0) { - if (out_of_memory()) - oom_kill(); - continue; - -Which just ignores the result of do_try_to_free_pages and allows kswapd to -sleep normally, even when it thinks it hasn't achieved its free memory -target. This reduced the steady-state cpu usage to about 35%, still very -unimpressive but no longer a DoS. With this patch in place, cpu usage drops -to about 18% when the program sleeps, so some of the cpu is being hogged by -do_try_to_free_pages on the kswapd path, and a roughly equal amount by -do_try_to_free_pages on the synchonous alloc_pages path. - -Ben confirmed my results on his machine but observed that my patch did not -have much effect with 3.5 Gig in the machine instead of 2 Gig. So we know -that the badness scales with memory size. - -With my patch in place, a profile during the steady state looks like this: - - % cumulative self self total - time seconds seconds calls us/call us/call name - 71.62 25.61 25.61 56190 455.78 455.78 default_idle - 7.10 28.15 2.54 2138 1188.03 1253.38 refill_inactive_scan - 6.15 30.35 2.20 2849 772.20 819.82 page_launder - 5.26 32.23 1.88 stext_lock - 2.82 33.24 1.01 10307 97.99 99.65 DAC960_BA_InterruptHandler - 1.09 33.63 0.39 USER - 0.78 33.91 0.28 3464 80.83 92.37 do_softirq - 0.36 34.04 0.13 160337 0.81 0.87 reclaim_page - 0.34 34.16 0.12 87877 1.37 1.48 schedule - 0.34 34.28 0.12 mcount - 0.28 34.38 0.10 13862 7.21 7.21 statm_pgd_range - 0.25 34.47 0.09 10891694 0.01 0.01 zone_inactive_plenty - 0.14 34.52 0.05 160287 0.31 0.59 try_to_free_buffers - -The stext_lock suggests that lock contention is excessive. However, ordinary -scanning is the real cpu hog. - -At this point I ran out of time and didn't pursue the obvious question of why -so much more scanning than necessary is being done. Clearly, -refill_inactive_scan and page_launder aren't reaching their targets, but why? - -Questions remain as to why Rik's mm is more heaviliy DoSed than 2.4.9, and why -Andrea's locks up completely. I'll be available if anyone wants to talk more -about this, and in a couple weeks I'll return to it if the problem survives -that long. - -Rik, Andrea, enjoy ;-) - --- -Daniel -- -To unsubscribe from this list: send the line "unsubscribe linux-kernel" in -the body of a message to majordomo@vger.kernel.org -More majordomo info at http://vger.kernel.org/majordomo-info.html -Please read the FAQ at http://www.tux.org/lkml/ - - diff --git a/scratch/hackbench.c b/scratch/hackbench.c deleted file mode 100644 index c0d713cc..00000000 --- a/scratch/hackbench.c +++ /dev/null @@ -1,261 +0,0 @@ -From linux-kernel-owner@vger.kernel.org Tue Dec 11 01:11:36 2001 -Received: from sgi.com (sgi.engr.sgi.com [192.26.80.37]) by tulip-e185.americas.sgi.com (980427.SGI.8.8.8/SGI-server-1.7) with ESMTP id BAA82859; Tue, 11 Dec 2001 01:11:36 -0600 (CST) -Received: from vger.kernel.org ([199.183.24.194]) - by sgi.com (980327.SGI.8.8.8-aspam/980304.SGI-aspam: - SGI does not authorize the use of its proprietary - systems or networks for unsolicited or bulk email - from the Internet.) - via ESMTP id XAA08571; Mon, 10 Dec 2001 23:11:32 -0800 (PST) - mail_from (linux-kernel-owner@vger.kernel.org) -Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand - id ; Tue, 11 Dec 2001 02:07:16 -0500 -Received: (majordomo@vger.kernel.org) by vger.kernel.org - id ; Tue, 11 Dec 2001 02:06:57 -0500 -Received: from [202.135.142.194] ([202.135.142.194]:24588 "EHLO - wagner.rustcorp.com.au") by vger.kernel.org with ESMTP - id ; Tue, 11 Dec 2001 02:06:47 -0500 -Received: from wagner.rustcorp.com.au ([127.0.0.1] helo=rustcorp.com.au) - by wagner.rustcorp.com.au with esmtp (Exim 3.32 #1 (Debian)) - id 16Dh0t-0003yl-00; Tue, 11 Dec 2001 18:07:39 +1100 -From: Rusty Russell -To: linux-kernel@vger.kernel.org -cc: lse-tech@lists.sourceforge.net -Subject: hackbench: New Multiqueue Scheduler Benchmark -Date: Tue, 11 Dec 2001 18:07:39 +1100 -Message-Id: -Sender: linux-kernel-owner@vger.kernel.org -Precedence: bulk -X-Mailing-List: linux-kernel@vger.kernel.org -Status: RO -Content-Length: 4977 - -Hi all, - - I've cut down the chat benchmark into a version which doesn't -use threads or semaphores, and called it hackbench: - -On a 12-way PPC64: -2.4.17-pre7: - hackbench 50: Time: 851.469 Time: 847.143 Time: 826.868 - -2.4.17-pre7-multiqueue-patch: - hackbench 50: Time: 15.120 Time: 14.766 Time: 15.067 - -"hackbench 1" creates a group of 20 processes listening on a socket -each, and 20 writers: each of the writers writes 100 messages to each -socket (ie. 20 x 100 messages each). - -"hackbench 50" simply runs 50 of these groups in parallel. You'd -expect it to be 5 times slower than hackbench 10, but without the -multiqueue patch: - -10: Time: 10.573 Time: 13.471 Time: 9.289 -50: Time: 851.469 Time: 847.143 Time: 826.868 - -Enjoy, -Rusty. --- - Anyone who quotes me in their sig is an idiot. -- Rusty Russell. - -/* Test groups of 20 processes spraying to 20 receivers */ -#include -#include -#include -#include -#include -#include -#include -#include - -#define DATASIZE 100 -static unsigned int loops = 100; -static int use_pipes = 0; - -static void barf(const char *msg) -{ - fprintf(stderr, "%s (error: %s)\n", msg, strerror(errno)); - exit(1); -} - -static void fdpair(int fds[2]) -{ - if (use_pipes) { - if (pipe(fds) == 0) - return; - } else { - if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) == 0) - return; - } - barf("Creating fdpair"); -} - -/* Block until we're ready to go */ -static void ready(int ready_out, int wakefd) -{ - char dummy; - struct pollfd pollfd = { .fd = wakefd, .events = POLLIN }; - - /* Tell them we're ready. */ - if (write(ready_out, &dummy, 1) != 1) - barf("CLIENT: ready write"); - - /* Wait for "GO" signal */ - if (poll(&pollfd, 1, -1) != 1) - barf("poll"); -} - -/* Sender sprays loops messages down each file descriptor */ -static void sender(unsigned int num_fds, - int out_fd[num_fds], - int ready_out, - int wakefd) -{ - char data[DATASIZE]; - unsigned int i, j; - - ready(ready_out, wakefd); - - /* Now pump to every receiver. */ - for (i = 0; i < loops; i++) { - for (j = 0; j < num_fds; j++) { - int ret, done = 0; - - again: - ret = write(out_fd[j], data + done, sizeof(data)-done); - if (ret < 0) - barf("SENDER: write"); - done += ret; - if (done < sizeof(data)) - goto again; - } - } -} - -/* One receiver per fd */ -static void receiver(unsigned int num_packets, - int in_fd, - int ready_out, - int wakefd) -{ - unsigned int i; - - /* Wait for start... */ - ready(ready_out, wakefd); - - /* Receive them all */ - for (i = 0; i < num_packets; i++) { - char data[DATASIZE]; - int ret, done = 0; - - again: - ret = read(in_fd, data + done, DATASIZE - done); - if (ret < 0) - barf("SERVER: read"); - done += ret; - if (done < DATASIZE) - goto again; - } -} - -/* One group of senders and receivers */ -static unsigned int group(unsigned int num_fds, - int ready_out, - int wakefd) -{ - unsigned int i; - unsigned int out_fds[num_fds]; - - for (i = 0; i < num_fds; i++) { - int fds[2]; - - /* Create the pipe between client and server */ - fdpair(fds); - - /* Fork the receiver. */ - switch (fork()) { - case -1: barf("fork()"); - case 0: - close(fds[1]); - receiver(num_fds*loops, fds[0], ready_out, wakefd); - exit(0); - } - - out_fds[i] = fds[1]; - close(fds[0]); - } - - /* Now we have all the fds, fork the senders */ - for (i = 0; i < num_fds; i++) { - switch (fork()) { - case -1: barf("fork()"); - case 0: - sender(num_fds, out_fds, ready_out, wakefd); - exit(0); - } - } - - /* Close the fds we have left */ - for (i = 0; i < num_fds; i++) - close(out_fds[i]); - - /* Return number of children to reap */ - return num_fds * 2; -} - -int main(int argc, char *argv[]) -{ - unsigned int i, num_groups, total_children; - struct timeval start, stop, diff; - unsigned int num_fds = 20; - int readyfds[2], wakefds[2]; - char dummy; - - if (argv[1] && strcmp(argv[1], "-pipe") == 0) { - use_pipes = 1; - argc--; - argv++; - } - - if (argc != 2 || (num_groups = atoi(argv[1])) == 0) - barf("Usage: hackbench [-pipe] \n"); - - fdpair(readyfds); - fdpair(wakefds); - - total_children = 0; - for (i = 0; i < num_groups; i++) - total_children += group(num_fds, readyfds[1], wakefds[0]); - - /* Wait for everyone to be ready */ - for (i = 0; i < total_children; i++) - if (read(readyfds[0], &dummy, 1) != 1) - barf("Reading for readyfds"); - - gettimeofday(&start, NULL); - - /* Kick them off */ - if (write(wakefds[1], &dummy, 1) != 1) - barf("Writing to start them"); - - /* Reap them all */ - for (i = 0; i < total_children; i++) { - int status; - wait(&status); - if (!WIFEXITED(status)) - exit(1); - } - - gettimeofday(&stop, NULL); - - /* Print time... */ - timersub(&stop, &start, &diff); - printf("Time: %lu.%03lu\n", diff.tv_sec, diff.tv_usec/1000); - exit(0); -} -- -To unsubscribe from this list: send the line "unsubscribe linux-kernel" in -the body of a message to majordomo@vger.kernel.org -More majordomo info at http://vger.kernel.org/majordomo-info.html -Please read the FAQ at http://www.tux.org/lkml/ - - diff --git a/scratch/lat-sched.c b/scratch/lat-sched.c deleted file mode 100644 index ffffc0a8..00000000 --- a/scratch/lat-sched.c +++ /dev/null @@ -1,346 +0,0 @@ -/* - * lat-sched by Davide Libenzi ( linux kernel scheduler latency tester ) - * Version 0.21 - Copyright (C) 2001 Davide Libenzi - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Davide Libenzi - * - * - * The purpose of this tool is to measure the scheduler latency over a given - * runqueue length. The major difference with lat_ctx is that during the test - * time the runqueue is exactly NRTASK, while with lat_ctx ( that uses pipes ) - * processes are typically sleeping on the pipe read. - * Build: - * - * gcc -O0 -o lat-sched lat-sched.c - * - * Use: - * - * lat-sched [--ntasks n] [--ttime s] [--size b] [--stksize b] [--stkalign b] - * [--max-eck k] [--verbose] [--help] - * - * --ntask = Set the number of tasks ( runqueue length ) - * --ttime = Set thetest measure time in seconds - * --size = Set the cache drain size in Kb - * --stksize = Set the stack size for tasks - * --stkalign = Set the shift each task stack will have over stksize - * --max-eck = Set the maximum correction factor above which the measure is invalid - * --verbose = Activate verbose mode - * --help = Print help screen - * - * - * Output: NRTASK MSRUN CSSEC LATSCH AVGWRK THRZ CHISQR - * - * NRTASK = Number of test tasks - * MSRUN = Number of milliseconds the test is ran - * CSSEC = Number of context switches / sec - * LATSCH = Number of seconds for a context switch - * AVGWRK = Number of context switches / NRTASK - * THRZ = Number of task with zero context switch - * CHISQR = Context switches chi-square over tasks - * - * In case the measure will result invalid ( according to eck ) the output line - * will begin with a '*' character. - * Messages are printed on while results are printed on - * - * IMPORTANT: To make this test work with a number of tasks that is less or equal - * to the number of CPUs the sys_sched_yield() optimization must be removed from - * the kernel sources in . - * This is a working sys_sched_yield() for kernel 2.4.10 : - * - * asmlinkage long sys_sched_yield(void) { - * if (current->policy == SCHED_OTHER) - * current->policy |= SCHED_YIELD; - * current->need_resched = 1; - * return 0; - * } - * - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -#define CACHELINE_SIZE 32 - - -#define SSUMTIME 1 -#define MAXTASKS 2048 -#define MEASURE_TIME 4 -#define STK_SIZE 512 - - - -char *stacks; -int *data; -int datasize = 0, stksize = STK_SIZE, stkalign = 0; -pid_t thr[MAXTASKS]; -int nbtasks = 2; -int measure_time = MEASURE_TIME; -double eck = 0.9; -volatile atomic_t actthreads = ATOMIC_INIT(0); -long long int totalwork[MAXTASKS]; -volatile int stop = 0, start = 0, count = 0; -int verbose = 0; - - -/* - * cacheload() code comes from Larry McVoy LMBench - * Bring howmuch data into the cache, assuming that the smallest cache - * line is 16/32 bytes. - */ -int cacheload(int howmuch) { - int done, sum = 0; - register int *d = data; - -#if CACHELINE_SIZE == 16 - -#define ASUM sum+=d[0]+d[4]+d[8]+d[12]+d[16]+d[20]+d[24]+d[28]+\ - d[32]+d[36]+d[40]+d[44]+d[48]+d[52]+d[56]+d[60]+\ - d[64]+d[68]+d[72]+d[76]+d[80]+d[84]+d[88]+d[92]+\ - d[96]+d[100]+d[104]+d[108]+d[112]+d[116]+d[120]+d[124];\ - d+=128; /* ints; bytes == 512 */ - -#elif CACHELINE_SIZE == 32 - -#define ASUM sum+=d[0]+d[8]+d[16]+d[24]+d[32]+d[40]+d[48]+d[56]+\ - d[64]+d[72]+d[80]+d[88]+d[96]+d[104]+d[112]+d[120];\ - d+=128; /* ints; bytes == 512 */ - -#else - -#define ASUM sum+=d[0]+d[1]+d[2]+d[3]+d[4]+d[5]+d[6]+d[7]+d[8]+d[9]+\ - d[10]+d[11]+d[12]+d[13]+d[14]+d[15]+d[16]+d[17]+d[18]+d[19]+\ - d[20]+d[21]+d[22]+d[23]+d[24]+d[25]+d[26]+d[27]+d[28]+d[29]+\ - d[30]+d[31]+d[32]+d[33]+d[34]+d[35]+d[36]+d[37]+d[38]+d[39]+\ - d[40]+d[41]+d[42]+d[43]+d[44]+d[45]+d[46]+d[47]+d[48]+d[49]+\ - d[50]+d[51]+d[52]+d[53]+d[54]+d[55]+d[56]+d[57]+d[58]+d[59]+\ - d[60]+d[61]+d[62]+d[63]+d[64]+d[65]+d[66]+d[67]+d[68]+d[69]+\ - d[70]+d[71]+d[72]+d[73]+d[74]+d[75]+d[76]+d[77]+d[78]+d[79]+\ - d[80]+d[81]+d[82]+d[83]+d[84]+d[85]+d[86]+d[87]+d[88]+d[89]+\ - d[90]+d[91]+d[92]+d[93]+d[94]+d[95]+d[96]+d[97]+d[98]+d[99]+\ - d[100]+d[101]+d[102]+d[103]+d[104]+\ - d[105]+d[106]+d[107]+d[108]+d[109]+\ - d[110]+d[111]+d[112]+d[113]+d[114]+\ - d[115]+d[116]+d[117]+d[118]+d[119]+\ - d[120]+d[121]+d[122]+d[123]+d[124]+d[125]+d[126]+d[127];\ - d+=128; /* ints; bytes == 512 */ - -#endif - -#define ONEKB ASUM ASUM - - for (done = 0; done < howmuch; done += 1024) { - ONEKB - } - return sum; -} - - -void taskproc(unsigned int thr) { - long long int counter = 0; - - while (!start) - usleep(100000); - - atomic_inc((atomic_t *) &actthreads); - - while (!stop) { - if (count) { - ++counter; - cacheload(datasize); - } - syscall(158); /* sys_sched_yield() */ - } - totalwork[thr] = counter; - atomic_dec((atomic_t *) &actthreads); - exit(0); -} - - - -unsigned long long getmstics(void) { - struct timeval tv; - - if (gettimeofday(&tv, NULL) != 0) - return (0); - - return 1000 * (unsigned long long) tv.tv_sec + (unsigned long long) tv.tv_usec / 1000; -} - - -void usage(char *prg) { - fprintf(stderr, - "use: %s [--ntasks n {%d}] [--ttime s {%d}] [--size b {%d}] [--stksize b {%d}]\n" - "\t[--stkalign b {%d}] [--max-eck k {%lf}] [--verbose] [--help]\n", - prg, nbtasks, measure_time, datasize, stksize, stkalign, eck); -} - - -main(int argc, char **argv) { - int i, status, avgwork, thrzero = 0, stkrsiz; - long long int value = 0, avgvalue; - double sqrdev; - unsigned long long ts, te, sts, ste, ttime, sits, is, tcorr; - char const *ustr = ""; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "--ntasks") == 0) { - if (++i < argc) - nbtasks = atoi(argv[i]); - continue; - } - if (strcmp(argv[i], "--ttime") == 0) { - if (++i < argc) - measure_time = atoi(argv[i]); - continue; - } - if (strcmp(argv[i], "--stksize") == 0) { - if (++i < argc) - stksize = atoi(argv[i]), stksize &= ~(CACHELINE_SIZE - 1); - continue; - } - if (strcmp(argv[i], "--size") == 0) { - if (++i < argc) - datasize = atoi(argv[i]) * 1024; - continue; - } - if (strcmp(argv[i], "--max-eck") == 0) { - if (++i < argc) - eck = atof(argv[i]); - continue; - } - if (strcmp(argv[i], "--stkalign") == 0) { - if (++i < argc) - stkalign = atoi(argv[i]), stkalign &= ~(CACHELINE_SIZE - 1); - continue; - } - if (strcmp(argv[i], "--verbose") == 0) { - verbose = 1; - continue; - } - if (strcmp(argv[i], "--help") == 0) { - usage(argv[0]); - exit(9); - } - } - - if (nbtasks > MAXTASKS) - nbtasks = MAXTASKS; - - if (datasize) - data = (int *) malloc(datasize); - - stkrsiz = stkalign + stksize; - if (!(stacks = (char *) malloc((nbtasks + 1) * stkrsiz))) { - perror("stack alloc"); - exit(1); - } - - if (verbose) fprintf(stderr, "\ncreating %d tasks ...", nbtasks); - for (i = 0; i < nbtasks; i++) { - thr[i] = __clone((void *) &taskproc, stacks + (i + 1) * stkrsiz, - CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, (void *) i); - if (thr[i] == -1) { - perror("clone"); - exit(2); - } - } - - for (i = 0; i < nbtasks; i++) - totalwork[i] = 0; - - if (verbose) fprintf(stderr, " ok\nwaiting for all tasks to start ..."); - - start = 1; - while (atomic_read(&actthreads) != nbtasks) - usleep(100000); - - if (verbose) fprintf(stderr, " ok\nrunning test ..."); - - count = 1; - ts = getmstics(); - - sleep(measure_time); - - count = 0; - stop = 1; - te = getmstics(); - - if (verbose) fprintf(stderr, " ok\nwaiting completion ..."); - - while (atomic_read(&actthreads) > 0) - usleep(100000); - - for (i = 0; i < nbtasks; i++) - wait(&status); - - if (verbose) fprintf(stderr, " ok\n"); - - for (i = 0; i < nbtasks; i++) { - value += totalwork[i]; - if (totalwork[i] == 0) - ++thrzero; - } - - if (verbose) fprintf(stderr, "compensation loop ..."); - is = (value * 1000 * SSUMTIME) / (te - ts); - do { - sits = is; - sts = getmstics(); - - for (; is; is--) - cacheload(datasize); - - ste = getmstics(); - is = 3 * (sits * 1000 * SSUMTIME) / (2 * (ste - sts)); - } while ((ste - sts) < 1000 * SSUMTIME); - tcorr = ((ste - sts) * value) / sits; - if (verbose) fprintf(stderr, " sits=%llu comptime=%llu corr=%llu value=%llu citt=%e\n", - sits, ste - sts, tcorr, value, (double) (ste - sts) / ((double) sits * 1000.0)); - if ((double) tcorr > eck * (te - ts)) { - if (verbose) fprintf(stderr, "measure unstable: corr{%llu} > (eck{%lf} * ttime{%llu})\n", - tcorr, eck, te - ts); - ustr = "*"; - } - ttime = (te - ts) - tcorr; - avgvalue = value / nbtasks; - value *= 1000; - value /= ttime; - avgwork = (int) (value / nbtasks); - - for (i = 0, sqrdev = 0; i < nbtasks; i++) { - double difvv = (double) (totalwork[i] - avgvalue); - - sqrdev += (difvv * difvv) / (double) avgvalue; - } - - fprintf(stdout, "%s%d\t%lu\t%lld\t%e\t%d\t%d\t%.0f\n", - ustr, nbtasks, (unsigned long) (te - ts), value, 1.0 / (double) value, avgwork, thrzero, sqrdev); - - exit(0); -} - diff --git a/scratch/runltp.orig b/scratch/runltp.orig deleted file mode 100755 index de6df161..00000000 --- a/scratch/runltp.orig +++ /dev/null @@ -1,541 +0,0 @@ -################################################################################ -## ## -## Copyright (c) International Business Machines Corp., 2001 ## -## ## -## 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -## ## -################################################################################ -# -# File: runltp -# -# Description: This program is a Graphical User Interface (GUI) -# Control Centre for LTP. The Control Centre provides -# functionality to Compile, Execute and View Results of -# LTP test cases. -# -# Note: The commands listed below are executed in the background and -# the function checks to see at priodic intervals (10s) if this -# program is still alive and runnning. If it is still -# running the output of this program is displayed on a window, -# or the status bar is updated to indicate progress. -# if anyone has a better idea, delete this "Note" and -# send me the patch. -# 1. make clean -# 2. make -# 3. make install -# 4. runalltests.sh -# -# Author: Manoj Iyer - manjo@mail.utexas.edu -# -# Thanks: Jim Choate - For suggesting the use of dialog command. -# -# History: March 26 2003 - Created. -# -#! /bin/bash - -# Function: cleanup -# -# Description: Remove all temporary files created by this program. Cleanup -# always called on program exit. -# -# Input: NONE -# -# Output: NONE -cleanup() -{ - rm -f /tmp/runltp.* -} - - -# Function: display_info_msg -# -# Description: Displays informational messages window. This window may -# may be used to display information like errors, instructions -# etc to the user. The window is dismissed when the user hits -# the [ENTER] key. -# -# Input: $1 - Title the needs to be displayed on the window. -# eg: ERROR: Compiling LTP -# $2 - Message text. -# -# Output: Information message window. -display_info_msg() -{ - dialog --backtitle "Linux Test Project Control Centre" \ - --cr-wrap \ - --tab-correct \ - --title " $1 " \ - --msgbox " $2 " 10 70 - return $? -} - - -# Function: do_make_clean -# -# Description: This function executes a "make clean" under the ltp-mmddyy/ -# directory inorder to remove executables and object files -# that may exist from previous compilation. It displays the -# progress in a window, and indicated percent complete. -# -# Input: NONE -# -# Output: Progress window indicating percent completed. -do_make_clean() -{ - RC=1 - PCT=10 - make clean &>/tmp/runltp.comperr.$$ & - ( - while [ $RC -ne 0 ] - do - RC=$(ps -C make | grep make | wc -l | awk '{print $1}') - echo "XXX" - echo $PCT - echo "XXX" - PCT=`expr $PCT + 10` - sleep 1 - done - ) | - dialog --backtitle "Linux Test Project Control Centre" \ - --title "Compiling LTP testsuite - clean" \ - --gauge "Percent completed" 10 70 - return -} - - -# Function: do_make -# -# Description: This function executes a "make" under the ltp-mmddyy/ -# directory and creates executables, object files & libraries -# It displays the progress in a window, and indicated percent -# complete. -# -# Input: NONE -# -# Output: Progress window indicating percent completed. -do_make() -{ - RC=1 - PCT=1 - make &>/tmp/runltp.comperr.$$ & - ( - while [ $RC -ne 0 ] - do - RC=$(ps -C make | grep make | wc -l | awk '{print $1}') - echo "XXX" - echo $PCT - echo "XXX" - PCT=`expr $PCT + 1` - sleep 10s - done - ) | - dialog --backtitle "Linux Test Project Control Centre" \ - --title "Compiling LTP testsuite - make" \ - --gauge "Percent completed" 10 70 -} - - -# Function: do_make_install -# -# Description: This function executes a "make install" under the ltp-mmddyy/ -# directory inorder to install executables and libraries, -# the install is done under ltp-mmddyy/testcases/bin/ . -# It displays the progress in a window, and indicated percent -# complete. -# -# Input: NONE -# -# Output: Progress window indicating percent completed. -do_make_install() -{ - RC=1 - PCT=1 - make install &>/tmp/runltp.comperr.$$ & - ( - while [ $RC -ne 0 ] - do - RC=$(ps -C make | grep make | wc -l | awk '{print $1}') - echo "XXX" - echo $PCT - echo "XXX" - PCT=`expr $PCT + 1` - sleep 10s - done - ) | - dialog --backtitle "Linux Test Project Control Centre" \ - --title "Compiling LTP testsuite - install" \ - --gauge "Percent completed" 10 70 -} - - -# Function: compile_ltp -# -# Description: Checks for commands that are pre-reqs for compiling and -# installing LTP. It displays a confirmation window inorder to -# confirm the choice made by the user. -# -# Calls: do_make_clean() -# do_make() -# do_make_install() -# -# Input: NONE -# -# Output: Confirmation window. -compile_ltp() -{ - dialog --backtitle "Linux Test Project Control Centre" \ - --title "Compiling LTP testsuite"\ - --yesno "This will compile all the test cases in\ - LTP test suite and place the executables\ - in ltp-mmddyy/testcases/bin directory. Do\ - you wish to continue ??" 7 70 || RC=$? - case $RC in - 0) \ - for cmd in cc make lex ; - do \ - which $cmd &>/tmp/runltp.err.$$ ; - if [ $? -ne 0 ] ; - then \ - display_info_msg "Compiling LTP testsuite" \ - "ERROR: command $cmd not found, $cmd is\ - required to compile LTP test cases. Please\ - install $cmd or export PATH correctly before\ - running this program" ; - return ; - fi ; - done ; - - do_make_clean ; - do_make ; - do_make_install ; - return ;; - - 1) return ;; - - 255) return ;; - esac -} - - -# Function: disp_ltpres -# -# Description: The results generated after the ltp execution located under -# ltp-mmddyy/results/ directory in a text (ASCII) file called -# results.todaysdate. This function displays this file in a -# window. If the results file does not exit it displays an -# info message window notifing the user that LTP test cases -# need to be executed inorder to view results. -# -# Input: ltp-mmddyy/results/results.todaysdate -# -# Output: Window displaying results of testcases that were executed. -disp_ltpres() -{ - RC=0 - if ! [ -f ./results/results.$(date -I) ] - then - display_info_msg "LTP Test Results" \ - "Sorry cannot display test results, you have to run \ - the test cases first. Please choose the Execute LTP \ - option in the Main Menu." - return - fi - - dialog --backtitle "Linux Test Project Control Centre" \ - --exit-label "Return to Main Menu" \ - --title "LTP Test Results. Scroll [UP] [DOWN]/[PGUP] [PGDN]" \ - --textbox ./results/results.$(date -I) 17 70 - - dialog --backtitle "Linux Test Project Control Centre" \ - --defaultno \ - --title "LTP Test Results." \ - --yesno "Would you like to share these results with the LTP \ - community by posting it to the LTP results mailing list?" \ - 7 70 || RC=$? - case $RC in - 0) \ - mail ltp-results@lists.sourceforge.net < \ - ./results/results.$(date -I) ; - return ;; - - 1) return ;; - - 255) return ;; - esac - return -} - - -# Function: exectest_screenout -# -# Description: Execute tests by calling runalltests.sh, display test status -# in a window. -# -# Input: $1 - Flag to be passed to runalltests.sh inorder to run -# networking tests. -# -# Output: Window showing messages printed by testcases. -exectest_screenout() -{ - RC=1 # setting return code to 1, to loop in while - - # remove old results file - rm ./results/results.$(date -I) &>/dev/null - - # execute runalltests.sh with user defined command file. - ./runalltests.sh -q -p $1 -l results.$(date -I) \ - -f /tmp/runltp.test.list.$$ &>/tmp/runltp.runall.out.$$ & - ( - while [ $RC -ne 0 ] - do - RC=$(ps -C runalltests.sh | grep runalltests.sh | wc -l | \ - awk '{print $1}') - done - ) | - dialog --backtitle "Linux Test Project Control Centre" \ - --clear \ - --exit-label "Return to Main Menu" \ - --title "Executing LTP testsuite - Screen out" \ - --tailbox /tmp/runltp.runall.out.$$ 17 70 - - dialog --clear - - return -} - - -# Function: execute_ltp -# -# Description: This function provides a menu of testcases that can be -# selected for execution. If networking tests are selected, -# they require a remote machine and remote machines root -# users password. The user will be prompted to enter this -# information in a text box. -# The function checks to see if the ltp-mmddyy/testcases/bin -# directory was created, this directory is created when the -# testcases are compiled and installed, if it is not found -# an info message window will notify the user that LTP needs to -# be compiled before tests can be executed. -# This function creates the senatrio file based on the users -# choice of testcases and uses the runalltests.sh script to -# execute these tests. -# The messages printed by the testcases are displayed on this -# terminal. -# -# Input: Users selection of testcases; scenario file. -# -# Output: Test selection window, Message window, -# information message window -execute_ltp() -{ - RC=0 - host_name=" " - rhost_passwd=" " - run_net_test=" " - - if ! [ -d ./testcases/bin ] - then - display_info_msg "Executing LTP testcases" \ - "The testcases must to be compiled inorder\ - to execute them. Returning to main menu. \ - Please select the Compile option." - return - fi - - dialog --backtitle "Linux Test Project Control Centre"\ - --title "Execute LTP" --clear\ - --cancel-label 'Exit' \ - --checklist "Select [SPACEBAR] tests to run" 20 61 5 \ - "commands" "General Linux commands" off\ - "crashme" "Utility to crash your machine" off\ - "dio" "Direct IO tests" off\ - "fs" "Filesystem stress tests" ON\ - "fsx" "Another filesystem stress test" ON\ - "hyperthreading" "Hyperthreading stress tests" off\ - "io" "General I/O stress" ON\ - "ipc" "Interprocess communication stress" ON\ - "ipv6" "IPV6 related tests" off\ - "math" "Math library tests (CPU stress)" ON\ - "mm" "Memory Mgmt tests" ON\ - "multicast" "Multicast networking tests" off\ - "nfs" "Network filesystem stress" off\ - "pipes" "IPC pipes stress" ON\ - "pty" "Terminal type stress" off\ - "rpc" "Remote Procedure Call" off\ - "sched" "Scheduler Stress Tests" ON\ - "sctp_ipv6" "SCTP over IPv6" off\ - "sctp_tcp" "SCTP over TCP" off\ - "sctp_udp" "SCTP over UDP" off\ - "super" "mknod and setuid tests" off\ - "syscalls" "Kernel system calls" ON\ - "tcp_cmds" "TCP/IP commands tests" off\ - 2>/tmp/runltp.choice.$$ || RC=$? - - tst_choice=$(cat /tmp/runltp.choice.$$) - case $RC in - 0) \ - for i in $tst_choice ; - do \ - cat ./runtest/$(echo $i | sed -e 's/"//g') \ - >> /tmp/runltp.test.list.$$ ; - if [[ $(echo $i | sed -e 's/"//g') == "tcp_cmds" || \ - $(echo $i | sed -e 's/"//g') == "multicast" || \ - $(echo $i | sed -e 's/"//g') == "ipv6" || \ - $(echo $i | sed -e 's/"//g') == "nfs" || \ - $(echo $i | sed -e 's/"//g') == "multicast" ]] ; - then \ - run_net_test=" -N " ; - fi ; - - done ; - if ! [ -z $run_net_test ] ; - then \ - dialog --backtitle "Linux Test Project Control Centre"\ - --title "Execute LTP test cases" \ - --cr-wrap --clear \ - --inputbox "You have chosen to execute testcases \ - that require a Remote Machine. \ - Please enter the fully qualified host \ - name" 0 0 $(hostname --long) \ - 2>/tmp/runltp.out.$$ ; - host_name=$(cat /tmp/runltp.out.$$ | awk '{print $1}') ; - unset $RHOST ; - RHOST=$host_name ; - export RHOST - - dialog --backtitle "Linux Test Project Control Centre"\ - --title "Execute LTP test cases" \ - --passwordbox " Please enter the root password \ - of this remote machine" 10 50 \ - 2>/tmp/runltp.out.$$ ; - rhost_passwd=$(cat /tmp/runltp.out.$$ | awk '{print $1}') ; - - PASSWD=$rhost_passwd ; - export PASSWD - fi ; - - if ! [ -d ./testcases/bin ] ; - then \ - display_info_msg "Executing LTP testcases" \ - "The testcases must to be compiled inorder\ - to execute them. Returning to main menu. \ - Please select the Compile option." ; - return ; - fi ; - - dialog --clear ; - - exectest_screenout $run_net_test ; - - return ;; - 1) \ - # echo "Cancel pressed" ; - return ;; - 255) \ - # echo "ESC pressed" ; - return ;; - esac -} - - -# Function: about_ltpcc -# -# Description: This function displays a window containing a brief message -# describing this programs functionality, and credits the author. -# -# Input: NONE -# -# Output: Message window, description of LTP Control Center. -about_ltpcc() -{ - display_info_msg "About LTP Control Centre" \ - "The LTP Control Centre can be used to\ - to compile, install and execute\ - The Linux Test Project test suite. Written by\ - Manoj Iyer - manjo@mail.utexas.edu" - return -} - - -# Function: main -# -# Description: Displays the main menu to the LTP Control Centre. The menu -# provides options to Compile, Execute, and View test execution -# results. -# -# Calls: about_ltpcc() -# compile_ltp() -# execute_ltp() -# disp_ltpres() -# -# Input: NONE -# -# Output: Menu selection of actions to perform. - -# Global variables. -RC=0 # return code from commands and local functions -mmenu_item=" " -RHOST=" " -PASSWD=" " - -# call cleanup function on program exit. -trap "cleanup" 0 - - -# wait in a loop until user hits [Cancel] button on the main menu. -while : -do - RC=0 - dialog --clear - dialog --backtitle "Linux Test Project Control Centre" \ - --cancel-label "Exit" \ - --title "Main Menu" \ - --menu "Move using[UP] [DOWN], Select using [ENTER]" 15 70 4 \ - About "About LTP Control Centre" \ - Compile "Compile LTP testsuite" \ - Execute "Execute LTP testsuite" \ - Results "Display a Summery of test results" \ - 2>/tmp/runltp.mainmenu.$$ || RC=$? - - case $RC in - 0) mmenu_item=`cat /tmp/runltp.mainmenu.$$` ; - # echo "return code = $RC" ; - # echo "MENU ITEM = $mmenu_item" ; - case $mmenu_item in - About) about_ltpcc ;; - Compile) compile_ltp ;; - Execute) execute_ltp ;; - Results) disp_ltpres ;; - esac ;; - - 1) display_info_msg "Good Bye!" \ - "Thank you for using Linux Test Project test suite.\ - Please visit our project website \ - http://ltp.sourceforge.net \ - for latest news on The Linux Test Project. \ - LTP Control Centre Author: Manoj Iyer - \ - manjo@mail.utexas.edu" ; - exit ;; - - 255) display_info_msg "Good Bye!" \ - "Thank you for using Linux Test Project test suite.\ - Please visit our project website\ - http://ltp.sourceforge.net for latest news\ - on The Linux Test Project. \ - LTP Control Centre Author: Manoj Iyer - \ - manjo@mail.utexas.edu" ; - exit;; - esac -done diff --git a/scratch/runltp.robbie b/scratch/runltp.robbie deleted file mode 100755 index fa734013..00000000 --- a/scratch/runltp.robbie +++ /dev/null @@ -1,413 +0,0 @@ -################################################################################ -## ## -## Copyright (c) International Business Machines Corp., 2001 ## -## ## -## 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -## ## -################################################################################ -# -# File: runltp -# -# Description: This program is a Graphical User Interface (GUI) -# Control Centre for LTP. The Control Centre provides -# functionality to Compile, Execute and View Results of -# LTP test cases. -# -# Author: Manoj Iyer - manjo@mail.utexas.edu -# -# Thanks: Jim Choate - For suggesting the use of dialog command. -# -# History: March 26 2003 - Created. -# -# March 28 2003 - Removed gauges and put make commands in foreground. -# Robbie Williamson - robbiew@us.ibm.com -# -# March 31 2003 - Made scenario menu creation dynamic and code -# to pull the test descriptions from the scenario files. -# Robbie Williamson - robbiew@us.ibm.com -# -#! /bin/bash - -# Function: cleanup -# -# Description: Remove all temporary files created by this program. Cleanup -# always called on program exit. -# -# Input: NONE -# -# Output: NONE -cleanup() -{ - rm -f /tmp/runltp.* -} - - -# Function: display_info_msg -# -# Description: Displays informational messages window. This window may -# may be used to display information like errors, instructions -# etc to the user. The window is dismissed when the user hits -# the [ENTER] key. -# -# Input: $1 - Title the needs to be displayed on the window. -# eg: ERROR: Compiling LTP -# $2 - Message text. -# -# Output: Information message window. -display_info_msg() -{ - dialog --backtitle "Linux Test Project Control Centre" \ - --title " $1 " \ - --msgbox " $2 " 10 70 - return $? -} - - -# Function: compile_ltp -# -# Description: Checks for commands that are pre-reqs for compiling and -# installing LTP. It displays a confirmation window inorder to -# confirm the choice made by the user. -# -# Calls: do_make_clean() -# do_make() -# do_make_install() -# -# Input: NONE -# -# Output: Confirmation window. -compile_ltp() -{ - dialog --backtitle "Linux Test Project Control Centre" \ - --title "Compiling LTP testsuite"\ - --yesno "This will compile all the test cases in\ - LTP test suite and place the executables\ - in testcases/bin directory. Do\ - you wish to continue ??" 7 70 || RC=$? - case $RC in - 0) \ - for cmd in cc make lex ; - do \ - which $cmd &>/tmp/runltp.err.$$ ; - if [ $? -ne 0 ] ; - then \ - display_info_msg "Compiling LTP testsuite" \ - "ERROR: command $cmd not found, $cmd is\ - required to compile LTP test cases. Please\ - install $cmd or export PATH correctly before\ - running this program" ; - return ; - fi ; - done ; - make clean; - if [ $? -ne 0 ];then - echo "ERROR in \'make clean\' - exiting." - exit - fi - make ; - if [ $? -ne 0 ];then - echo "ERROR in \'make all\' - exiting." - exit - fi - make install ; - if [ $? -ne 0 ];then - echo "ERROR in \'make install\' - exiting." - exit - fi - return ;; - - 1) return ;; - - 255) return ;; - esac -} - - -# Function: disp_ltpres -# -# Description: The results generated after the ltp execution located under -# ltp-mmddyy/results/ directory in a text (ASCII) file called -# results.todaysdate. This function displays this file in a -# window. If the results file does not exit it displays an -# info message window notifing the user that LTP test cases -# need to be executed inorder to view results. -# -# Input: ltp-mmddyy/results/results.todaysdate -# -# Output: Window displaying results of testcases that were executed. -disp_ltpres() -{ - RC=0 - if ! [ -f ./results/results.$(date -I) ] - then - display_info_msg "LTP Test Results" \ - "Sorry cannot display test results, you have to run \ - the test cases first. Please choose the Execute LTP \ - option in the Main Menu." - return - fi - - dialog --backtitle "Linux Test Project Control Centre" \ - --title "LTP Test Results. Scroll [UP] [DOWN]/[PGUP] [PGDN]" \ - --textbox ./results/results.$(date -I) 17 70 - - dialog --backtitle "Linux Test Project Control Centre" \ - --title "LTP Test Results." \ - --yesno "Would you like to share these results with the LTP \ - community by posting it to the LTP results mailing list?" \ - 7 70 || RC=$? - case $RC in - 0) \ - mail ltp-results@lists.sourceforge.net < \ - ./results/results.$(date -I) ; - return ;; - - 1) return ;; - - 255) return ;; - esac - return -} - - -# Function: exectest_screenout -# -# Description: Execute tests by calling runalltests.sh, display test status -# in a window. -# -# Input: $1 - Flag to be passed to runalltests.sh inorder to run -# networking tests. -# -# Output: messages printed by testcases. -exectest_screenout() -{ - RC=0 # setting return code to 0, to loop in while - - # remove old results file - rm ./results/results.$(date -I) &>/dev/null - - # execute runalltests.sh with user defined command file. - ./runalltests.sh -q -p $1 -l results.$(date -I) \ - -f /tmp/runltp.test.list.$$ - sleep 2 - return -} - - -# Function: execute_ltp -# -# Description: This function provides a menu of testcases that can be -# selected for execution. If networking tests are selected, -# they require a remote machine and remote machines root -# users password. The user will be prompted to enter this -# information in a text box. -# The function checks to see if the ltp-mmddyy/testcases/bin -# directory was created, this directory is created when the -# testcases are compiled and installed, if it is not found -# an info message window will notify the user that LTP needs to -# be compiled before tests can be executed. -# This function creates the senatrio file based on the users -# choice of testcases and uses the runalltests.sh script to -# execute these tests. -# The messages printed by the testcases are displayed on this -# terminal. -# -# Input: Users selection of testcases; scenario file. -# -# Output: Test selection window, Message window, -# information message window -execute_ltp() -{ - RC=0 - host_name=" " - rhost_passwd=" " - run_net_test=" " - - if ! [ -d ./testcases/bin ] - then - display_info_msg "Executing LTP testcases" \ - "The testcases must to be compiled inorder\ - to execute them. Returning to main menu. \ - Please select the Compile option." - return - fi - - LIST=$(for i in `ls -1 -A -I "CVS" runtest`; do echo -n "$i "; j=$(head -n1 runtest/$i | cut -d: -f2|sed s/" "/_/g); echo -n "$j off "; done) - dialog --backtitle "Linux Test Project Control Centre"\ - --title "Execute LTP" --clear\ - --checklist "Select [SPACEBAR] tests to run" 20 80 5 \ - $LIST \ - 2>/tmp/runltp.choice.$$ || RC=$? - size=`wc -m /tmp/runltp.choice.$$|awk '{print $1}'` - if [ $size -eq 0 ];then - tst_choice=$(echo "NULL") - else - tst_choice=$(cat /tmp/runltp.choice.$$) - fi - if [[ $tst_choice == NULL ]];then - RC=1 - fi - case $RC in - 0) \ - for i in $tst_choice ; - do \ - cat ./runtest/$(echo $i | sed -e 's/"//g') \ - >> /tmp/runltp.test.list.$$ ; - if [[ $(echo $i | sed -e 's/"//g') == "tcp_cmds" || \ - $(echo $i | sed -e 's/"//g') == "tcp_cmds_noexpect" || \ - $(echo $i | sed -e 's/"//g') == "multicast" || \ - $(echo $i | sed -e 's/"//g') == "ipv6" || \ - $(echo $i | sed -e 's/"//g') == "ipv6_noexpect" || \ - $(echo $i | sed -e 's/"//g') == "nfs" || \ - $(echo $i | sed -e 's/"//g') == "multicast" ]] ; - then \ - run_net_test=" -N " ; - fi ; - - done ; - if ! [ -z $run_net_test ] ; - then \ - dialog --backtitle "Linux Test Project Control Centre"\ - --title "Execute LTP test cases" \ - --clear \ - --inputbox "You have chosen to execute testcases \ - that require a Remote Machine. \ - Please enter the fully qualified host \ - name" 17 80 $(hostname --long) \ - 2>/tmp/runltp.out.$$ ; - host_name=$(cat /tmp/runltp.out.$$ | awk '{print $1}') ; - unset $RHOST ; - RHOST=$host_name ; - export RHOST; - - dialog --backtitle "Linux Test Project Control Centre"\ - --title "Execute LTP test cases" \ - --clear \ - --inputbox " Please enter the root password \ - of this remote machine" 17 80 \ - 2>/tmp/runltp.out.$$ ; - rhost_passwd=$(cat /tmp/runltp.out.$$ | awk '{print $1}') ; - - PASSWD=$rhost_passwd ; - export PASSWD; - fi ; - - if ! [ -d ./testcases/bin ] ; - then \ - display_info_msg "Executing LTP testcases" \ - "The testcases must to be compiled inorder\ - to execute them. Returning to main menu. \ - Please select the Compile option." ; - return ; - fi ; - - dialog --clear ; - - exectest_screenout $run_net_test ; - - return ;; - 1) \ - # echo "Cancel pressed" ; - return ;; - 255) \ - # echo "ESC pressed" ; - return ;; - esac -} - - -# Function: about_ltpcc -# -# Description: This function displays a window containing a brief message -# describing this programs functionality, and credits the author. -# -# Input: NONE -# -# Output: Message window, description of LTP Control Center. -about_ltpcc() -{ - display_info_msg "About LTP Control Centre" \ - "The LTP Control Centre can be used to\ - to compile, install and execute\ - The Linux Test Project test suite. Written by\ - Manoj Iyer " - return -} - -# Function: main -# -# Description: Displays the main menu to the LTP Control Centre. The menu -# provides options to Compile, Execute, and View test execution -# results. -# -# Calls: about_ltpcc() -# compile_ltp() -# execute_ltp() -# disp_ltpres() -# -# Input: NONE -# -# Output: Menu selection of actions to perform. - -# Global variables. -RC=0 # return code from commands and local functions -mmenu_item=" " -RHOST=" " -PASSWD=" " - -# call cleanup function on program exit. -trap "cleanup" 0 - - -# wait in a loop until user hits [Cancel] button on the main menu. -while : -do - RC=0 - dialog --clear - dialog --backtitle "Linux Test Project Control Centre" \ - --title "Main Menu" \ - --menu "Move using[UP] [DOWN], Select using [ENTER]" 15 70 4 \ - About "About LTP Control Centre" \ - Compile "Compile LTP testsuite" \ - Execute "Execute LTP testsuite" \ - Results "Display a summary of test results" \ - 2>/tmp/runltp.mainmenu.$$ || RC=$? - - case $RC in - 0) mmenu_item=`cat /tmp/runltp.mainmenu.$$` ; - # echo "return code = $RC" ; - # echo "MENU ITEM = $mmenu_item" ; - case $mmenu_item in - About) about_ltpcc ;; - Compile) compile_ltp ;; - Execute) execute_ltp ;; - Results) disp_ltpres ;; - esac ;; - - 1) display_info_msg "Good Bye!" \ - "Thank you for using Linux Test Project test suite.\ - Please visit our project website \ - http://ltp.sourceforge.net \ - for latest news on The Linux Test Project. " - exit ;; - - 255) display_info_msg "Good Bye!" \ - "Thank you for using Linux Test Project test suite.\ - Please visit our project website\ - http://ltp.sourceforge.net for latest news\ - on The Linux Test Project. " - exit;; - esac -done -- 2.11.4.GIT