"Frodo Baggins" <[EMAIL PROTECTED]> wrote:
> Are you sure this change is OK?
> Don't we need 'int main(int argc, char** argv)' in order to reference argv[0]?
>
> On Thu, Jun 5, 2008 at 12:56 PM, Jim Meyering <[EMAIL PROTECTED]> wrote:
> ...
>> diff --git a/libparted/tests/disk.c b/libparted/tests/disk.c
>> index 020bdc0..cf69b00 100644
>> --- a/libparted/tests/disk.c
>> +++ b/libparted/tests/disk.c
>> @@ -6,6 +6,7 @@
>>  #include <parted/parted.h>
>>
>>  #include "common.h"
>> +#include "progname.h"
>>
>>  static char* temporary_disk;
>>
>> @@ -87,6 +88,7 @@ END_TEST
>>  int
>>  main (void)
>>  {
>> +        set_program_name (argv[0]); <============ We don't have an argv 
>> array if we use 'int main (void)'

Ouch!  Thanks for reporting that!

And I had even ensured that "make distcheck" passed.
Obviously insufficient ;-)

Plus there were link problems.
Fixed and cleaned up with these two change sets
I've just pushed.


>From 1179e95b2133861c4841b14b76c2076e80cef4d6 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[EMAIL PROTECTED]>
Date: Sun, 8 Jun 2008 23:06:49 +0200
Subject: [PATCH] fix compile/link problems in libparted/tests

Since I didn't have check-devel installed where I'd been testing,
nothing was built in libparted/tests/.
* libparted/tests/label.c (main): Add argc and argv declarations.
* libparted/tests/disk.c (main): Likewise.
Reported by Frodo Baggins <[EMAIL PROTECTED]>.
* libparted/tests/Makefile.am (LDADD, AM_CPPFLAGS): Define, to compile
and link against gnulib-provided functions.
(label_CFLAGS, label_LDADD, disk_LDADD, etc.): Adjust.
(TESTS_ENVIRONMENT): Define, to propagate top_srcdir to test scripts.
---
 libparted/tests/Makefile.am |   25 +++++++++++++++++--------
 libparted/tests/disk.c      |    2 +-
 libparted/tests/label.c     |    2 +-
 3 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/libparted/tests/Makefile.am b/libparted/tests/Makefile.am
index d526207..fc42a43 100644
--- a/libparted/tests/Makefile.am
+++ b/libparted/tests/Makefile.am
@@ -1,18 +1,24 @@
 # This file is part of GNU Parted
-# Copyright (C) 1999, 2000, 2001, 2007 Free Software Foundation, Inc.
+# Copyright (C) 1999-2001, 2007-2008 Free Software Foundation, Inc.
 #
 # This file may be modified and/or distributed without restriction.

 TESTS = t1000-label.sh t2000-disk.sh
 EXTRA_DIST = $(TESTS)
-bin_PROGRAMS     = label disk
-label_CFLAGS    = $(CHECK_CFLAGS) -I$(top_srcdir)/include
-label_LDADD     = $(CHECK_LIBS) $(top_builddir)/libparted/libparted.la
-label_SOURCES   = common.h common.c label.c
+bin_PROGRAMS = label disk

-disk_CFLAGS    = $(CHECK_CFLAGS) -I$(top_srcdir)/include
-disk_LDADD     = $(CHECK_LIBS) $(top_builddir)/libparted/libparted.la
-disk_SOURCES   = common.h common.c disk.c
+LDADD = \
+  $(top_builddir)/libparted/libparted.la \
+  $(top_builddir)/lib/libparted.la \
+  $(CHECK_LIBS)
+
+AM_CPPFLAGS = \
+  $(CHECK_CFLAGS) \
+  -I$(top_srcdir)/lib \
+  -I$(top_srcdir)/include
+
+label_SOURCES = common.h common.c label.c
+disk_SOURCES  = common.h common.c disk.c

 MAINTAINERCLEANFILES = Makefile.in

@@ -26,3 +32,6 @@ init.sh: Makefile.in
        echo 'PATH=$(abs_builddir)$(PATH_SEPARATOR)$$PATH; export PATH' >> 
[EMAIL PROTECTED]
        chmod a-w [EMAIL PROTECTED]
        mv [EMAIL PROTECTED] $@
+
+TESTS_ENVIRONMENT = \
+  top_srcdir='$(top_srcdir)'
diff --git a/libparted/tests/disk.c b/libparted/tests/disk.c
index cf69b00..6e6d483 100644
--- a/libparted/tests/disk.c
+++ b/libparted/tests/disk.c
@@ -86,7 +86,7 @@ START_TEST (test_duplicate)
 END_TEST

 int
-main (void)
+main (int argc, char **argv)
 {
         set_program_name (argv[0]);
         int number_failed;
diff --git a/libparted/tests/label.c b/libparted/tests/label.c
index aa825f9..2871c2c 100644
--- a/libparted/tests/label.c
+++ b/libparted/tests/label.c
@@ -148,7 +148,7 @@ START_TEST (test_clone_label)
 END_TEST

 int
-main (void)
+main (int argc, char **argv)
 {
         set_program_name (argv[0]);
         int number_failed;
-- 
1.5.6.rc0.30.g7c3f3


>From b521054f9ece81e409b9e910b756825d7e6907ac Mon Sep 17 00:00:00 2001
From: Jim Meyering <[EMAIL PROTECTED]>
Date: Sun, 8 Jun 2008 23:18:02 +0200
Subject: [PATCH] adjust tests here (libparted/tests/), as done for tests/

* libparted/tests/Makefile.am (init.sh): Don't emit code to
source test-lib.sh.
* libparted/tests/t1000-label.sh: Source test-lib.sh, not init.sh.
* libparted/tests/t2000-disk.sh: Likewise.
---
 libparted/tests/Makefile.am    |    1 -
 libparted/tests/t1000-label.sh |    5 +++--
 libparted/tests/t2000-disk.sh  |    5 +++--
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/libparted/tests/Makefile.am b/libparted/tests/Makefile.am
index fc42a43..cde1602 100644
--- a/libparted/tests/Makefile.am
+++ b/libparted/tests/Makefile.am
@@ -28,7 +28,6 @@ init.sh: Makefile.in
        rm -f [EMAIL PROTECTED] $@
        echo 'PARTED_USABLE_TEST_DIR=$(PARTED_USABLE_TEST_DIR)' > [EMAIL 
PROTECTED]
        echo 'abs_top_srcdir=$(abs_top_srcdir)' >> [EMAIL PROTECTED]
-       echo '. $(abs_top_srcdir)/tests/test-lib.sh' >> [EMAIL PROTECTED]
        echo 'PATH=$(abs_builddir)$(PATH_SEPARATOR)$$PATH; export PATH' >> 
[EMAIL PROTECTED]
        chmod a-w [EMAIL PROTECTED]
        mv [EMAIL PROTECTED] $@
diff --git a/libparted/tests/t1000-label.sh b/libparted/tests/t1000-label.sh
index c7a4d66..900433f 100755
--- a/libparted/tests/t1000-label.sh
+++ b/libparted/tests/t1000-label.sh
@@ -1,6 +1,6 @@
 #!/bin/sh

-# Copyright (C) 2007 Free Software Foundation, Inc.
+# Copyright (C) 2007-2008 Free Software Foundation, 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
@@ -19,7 +19,8 @@ test_description='run the label unit tests in a directory 
supporting O_DIRECT'
 # This wrapper around the ./label binary is used to find a directory
 # in which one can open a file with the O_DIRECT flag.

-. ./init.sh
+: ${top_srcdir=../..}
+. $top_srcdir/tests/test-lib.sh

 test_expect_success \
     'run the actual tests' 'label'
diff --git a/libparted/tests/t2000-disk.sh b/libparted/tests/t2000-disk.sh
index 7a85b98..ae261a9 100755
--- a/libparted/tests/t2000-disk.sh
+++ b/libparted/tests/t2000-disk.sh
@@ -1,6 +1,6 @@
 #!/bin/sh

-# Copyright (C) 2007 Free Software Foundation, Inc.
+# Copyright (C) 2007-2008 Free Software Foundation, 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
@@ -19,7 +19,8 @@ test_description='run the disk unit tests in a directory 
supporting O_DIRECT'
 # This wrapper around the ./label binary is used to find a directory
 # in which one can open a file with the O_DIRECT flag.

-. ./init.sh
+: ${top_srcdir=../..}
+. $top_srcdir/tests/test-lib.sh

 test_expect_success \
     'run the actual tests' 'disk'
-- 
1.5.6.rc0.30.g7c3f3

_______________________________________________
parted-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/parted-devel

Reply via email to