Results 1 to 4 of 4

Thread: Patch for compress-gzip and compress-pbzip2

  1. #1
    Join Date
    Apr 2008
    Posts
    126

    Default Patch for compress-gzip and compress-pbzip2

    Generate compressfile only once, place it in pts-shared and output to /dev/null.

    Code:
    diff -Naur a/pts/test-resources/compress-gzip/install.sh b/pts/test-resources/compress-gzip/install.sh
    --- a/pts/test-resources/compress-gzip/install.sh	2008-05-26 20:52:23.000000000 +0200
    +++ b/pts/test-resources/compress-gzip/install.sh	2008-05-27 00:37:33.097831734 +0200
    @@ -2,7 +2,7 @@
     
     cat > gzip_process <<EOT
     #!/bin/sh
    -cat compressfile | gzip -c > /dev/null
    +gzip -c ../pts-shared/compressfile >/dev/null
     EOT
     chmod +x gzip_process
     
    diff -Naur a/pts/test-resources/compress-gzip/post.sh b/pts/test-resources/compress-gzip/post.sh
    --- a/pts/test-resources/compress-gzip/post.sh	2008-05-26 20:52:23.000000000 +0200
    +++ b/pts/test-resources/compress-gzip/post.sh	1970-01-01 01:00:00.000000000 +0100
    @@ -1,4 +0,0 @@
    -#!/bin/sh
    -
    -cd $1
    -rm -f compressfile
    diff -Naur a/pts/test-resources/compress-gzip/pre.sh b/pts/test-resources/compress-gzip/pre.sh
    --- a/pts/test-resources/compress-gzip/pre.sh	2008-05-26 20:52:23.000000000 +0200
    +++ b/pts/test-resources/compress-gzip/pre.sh	2008-05-27 00:21:32.712641935 +0200
    @@ -1,5 +1,7 @@
     #!/bin/sh
     
     cd $1
    -dd if=/dev/urandom of=compressfile bs=1024 count=524288
    +if test ! -e "../pts-shared/compressfile"; then
    +    dd if=/dev/urandom of=../pts-shared/compressfile bs=1024 count=524288
    +fi
     
    diff -Naur a/pts/test-resources/compress-pbzip2/install.sh b/pts/test-resources/compress-pbzip2/install.sh
    --- a/pts/test-resources/compress-pbzip2/install.sh	2008-05-27 00:25:50.999181970 +0200
    +++ b/pts/test-resources/compress-pbzip2/install.sh	2008-05-27 00:36:19.392444078 +0200
    @@ -11,10 +11,16 @@
     make pbzip2-static
     cd ..
     
    -cat > compress-pbzip2 <<EOT
    +cat > pbzip2_process <<EOT
     #!/bin/sh
     cd pbzip2-1.0.2/
    -/usr/bin/time -f "PBZIP2 Compress Time: %e Seconds" ./pbzip2 -k -f -p\$NUM_CPU_CORES -r -5 ../compressfile 2>&1
    -rm -f compressfile.bz2
    +./pbzip2 -c -p\$NUM_CPU_CORES -r -5 ../../pts-shared/compressfile >/dev/null
    +EOT
    +chmod +x pbzip2_process
    +
    +
    +cat > compress-pbzip2 <<EOT
    +#!/bin/sh
    +/usr/bin/time -f "PBZIP2 Compress Time: %e Seconds" ./pbzip2_process 2>&1
     EOT
     chmod +x compress-pbzip2
    diff -Naur a/pts/test-resources/compress-pbzip2/post.sh b/pts/test-resources/compress-pbzip2/post.sh
    --- a/pts/test-resources/compress-pbzip2/post.sh	2008-05-26 20:52:23.000000000 +0200
    +++ b/pts/test-resources/compress-pbzip2/post.sh	1970-01-01 01:00:00.000000000 +0100
    @@ -1,4 +0,0 @@
    -#!/bin/sh
    -
    -cd $1
    -rm -f compressfile
    diff -Naur a/pts/test-resources/compress-pbzip2/pre.sh b/pts/test-resources/compress-pbzip2/pre.sh
    --- a/pts/test-resources/compress-pbzip2/pre.sh	2008-05-26 20:52:23.000000000 +0200
    +++ b/pts/test-resources/compress-pbzip2/pre.sh	2008-05-27 00:21:57.916279657 +0200
    @@ -1,5 +1,7 @@
     #!/bin/sh
     
     cd $1
    -dd if=/dev/urandom of=compressfile bs=1024 count=524288
    +if test ! -e "../pts-shared/compressfile"; then
    +    dd if=/dev/urandom of=../pts-shared/compressfile bs=1024 count=524288
    +fi
    EDIT: corrected /dev/null output
    Last edited by apaige; 05-26-2008 at 06:41 PM.

  2. #2

    Default

    The reason right now that it's separate as the file is only present when the test is running, in order to conserve disk space. Is there a reasoning behind the approach you're proposing?

  3. #3
    Join Date
    Apr 2008
    Posts
    126

    Default

    The patch is twofold actually: the first part makes compressfile permanent, you can remove that part of the patch if you want. The second part prevents from creating a useless compressfile.bz2 file and outputs to /dev/null, just like with compress-gzip and encode-*.

    I thought regenerating the file from /dev/urandom every time was very redundant and unnecessary, but I see the point about saving space.
    At least regenerate the file only once when running the compression test suite (i.e. once for both the gzip and pbzip2 benchmarks).

  4. #4

    Default

    Quote Originally Posted by apaige View Post
    The patch is twofold actually: the first part makes compressfile permanent, you can remove that part of the patch if you want. The second part prevents from creating a useless compressfile.bz2 file and outputs to /dev/null, just like with compress-gzip and encode-*.

    I thought regenerating the file from /dev/urandom every time was very redundant and unnecessary, but I see the point about saving space.
    At least regenerate the file only once when running the compression test suite (i.e. once for both the gzip and pbzip2 benchmarks).
    I just committed the patch to output to /dev/null.

    I'm not sure if this will be in PTS 1.0.0, but I'll work on a way for determining inside a test whether another test is also in the queue to run that also depends upon the compressfile, or whether to delete it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •