bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: base64 tool?


From: Simon Josefsson
Subject: Re: base64 tool?
Date: Mon, 27 Feb 2006 12:31:07 +0100
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

Jim Meyering <address@hidden> writes:

> Simon Josefsson <address@hidden> wrote:
>> Here is an updated patch for Coreutils to provide the base64 command.
>>
>> I believe I have addressed all major comments given earlier, I'm
>> Cc:ing all people who helped me, maybe they can help review it again.
>>
>> The lib/base64.? files are from gnulib.
>>
>> Warning: it has not been tested much at all!
>
> Thank you!
>
> I've made some minor changes e.g., to get past coreutils `make distcheck':
>
>       * src/base64.c: Don't include .h files already included by system.h:
>       <string.h>, <stdlib.h>, <stdbool.h>, <limits.h>, <errno.h>.
>       Include "system.h" before the other lib/*.h header files.
>       Include <sys/types.h> before "system.h".
>       (wrap_write): Remove declaration of unused local, initial_column.
>       (wrap_write): Correct declaration syntax: s/size_t * V/size_t *V/.
>
>       * README: Add base64 to the list.

Excellent!

> Plus, I indented a few cpp directives in lib/base64.h,
> to make them consistent with the first #define.

I feeded gnulib with these.

> Would you please write a test script to go along with that?
> I'd prefer that you model the new file, say tests/misc/base64,
> after one of the existing ones that uses the Coreutils.pm module.
> For example, tests/misc/expand is nice and small.

I forgot to include it, it was part of the first patch.  Is the below
sufficient?

Thanks!

Index: tests/base64/Makefile.am
===================================================================
RCS file: tests/base64/Makefile.am
diff -N tests/base64/Makefile.am
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/base64/Makefile.am    27 Feb 2006 11:30:12 -0000
@@ -0,0 +1,12 @@
+## Process this file with automake to produce Makefile.in -*-Makefile-*-.
+
+EXTRA_DIST = $(TESTS)
+
+TESTS_ENVIRONMENT = \
+  top_srcdir=$(top_srcdir) \
+  srcdir=$(srcdir) \
+  PERL="$(PERL)" \
+  PATH="`pwd`/../../src$(PATH_SEPARATOR)$$PATH" \
+  PROG=base64
+
+TESTS = basic-1
Index: tests/base64/basic-1
===================================================================
RCS file: tests/base64/basic-1
diff -N tests/base64/basic-1
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/base64/basic-1        27 Feb 2006 11:30:12 -0000
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+: ${PERL=perl}
+: ${srcdir=.}
+
+$PERL -e 1 > /dev/null 2>&1 || {
+  echo 1>&2 "$0: configure didn't find a usable version of Perl," \
+    "so can't run this test"
+  exit 77
+}
+
+exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
+require 5.003;
+use strict;
+
+(my $program_name = $0) =~ s|.*/||;
+
+# Turn off localisation of executable's ouput.
address@hidden(LANGUAGE LANG LC_ALL)} = ('C') x 3;
+
+my $degenerate = "d41d8cd98f00b204e9800998ecf8427e";
+
+my @Tests =
+    (
+     ['empty', {IN=> {f=> ''}},        {OUT=>""}],
+     ['2', {IN=> {f=> 'a'}},   {OUT=>"YQ==\n"}],
+    );
+
+my $save_temps = $ENV{DEBUG};
+my $verbose = $ENV{VERBOSE};
+
+my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
+my $fail = run_tests ($program_name, $prog, address@hidden, $save_temps, 
$verbose);
+exit $fail;
+EOF




reply via email to

[Prev in Thread] Current Thread [Next in Thread]