summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@debian.org>2006-01-06 15:55:30 +0000
committerRoger Leigh <rleigh@debian.org>2006-01-06 15:55:30 +0000
commitd744e6fa2846855c1a457ec05ca951143d3f3b03 (patch)
tree0f514308bd7959335bfe5fe951441c903a6234e7
parent4e46cb031a26af34e6ac7c2e6e5df68256c58491 (diff)
downloadschroot-d744e6fa2846855c1a457ec05ca951143d3f3b03.tar.gz
* debian/rules: Build and run the testsuite in the build target.
* debian/control (Build-Depends): Add libcppunit-dev. * schroot/sbuild-util.cc (find_program_in_path): Split PATH on ':' characters. * test/sbuild-util.cc: New file: tests for sbuild-util functions. * test/testmain.cc: New file: test runner for all tests. * configure.ac: Add check and conditinal for CppUnit. * Makefile.am (SUBDIRS): Add test directory.
-rw-r--r--ChangeLog17
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac3
-rw-r--r--debian/control2
-rwxr-xr-xdebian/rules9
-rw-r--r--po/POTFILES.in6
-rw-r--r--po/en_GB.po413
-rw-r--r--schroot/Makefile.am1
-rw-r--r--schroot/sbuild-util.cc2
-rwxr-xr-xtest/.cvsignore9
-rw-r--r--test/Makefile.am34
-rw-r--r--test/sbuild-util.cc75
-rw-r--r--test/testmain.cc20
13 files changed, 412 insertions, 181 deletions
diff --git a/ChangeLog b/ChangeLog
index 50e00c1c..744cc336 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2006-01-06 Roger Leigh <rleigh@debian.org>
+
+ * debian/rules: Build and run the testsuite in the build target.
+
+ * debian/control (Build-Depends): Add libcppunit-dev.
+
+ * schroot/sbuild-util.cc
+ (find_program_in_path): Split PATH on ':' characters.
+
+ * test/sbuild-util.cc: New file: tests for sbuild-util functions.
+
+ * test/testmain.cc: New file: test runner for all tests.
+
+ * configure.ac: Add check and conditinal for CppUnit.
+
+ * Makefile.am (SUBDIRS): Add test directory.
+
2006-01-03 Roger Leigh <rleigh@debian.org>
* schroot/sbuild-session.cc
diff --git a/Makefile.am b/Makefile.am
index a474ce85..23e6f60d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,7 +20,7 @@
#
#####################################################################
-SUBDIRS = schroot doc po
+SUBDIRS = schroot test doc po
# Remove CVS directories from the generated tarball.
dist-hook:
diff --git a/configure.ac b/configure.ac
index 5ff712c0..80e0c89f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,6 +61,8 @@ AH_TEMPLATE(RUN_PARTS,, [run-parts binary])
AC_DEFINE_UNQUOTED(RUN_PARTS, ["$RUN_PARTS"], )
# Checks for libraries.
PKG_CHECK_MODULES([UUID], [uuid])
+AM_PATH_CPPUNIT([1.10.0], [HAVE_CPPUNIT=true])
+AM_CONDITIONAL([USE_UNIT_TESTS], [test -n "$HAVE_CPPUNIT"])
SCHROOT_CFLAGS="$UUID_CFLAGS"
AC_SUBST([SCHROOT_CFLAGS])
@@ -234,6 +236,7 @@ AC_CONFIG_FILES([schroot/setup/Makefile])
AC_CONFIG_FILES([schroot/schroot.1])
AC_CONFIG_FILES([schroot/schroot-setup.5])
AC_CONFIG_FILES([schroot/schroot.conf.5])
+AC_CONFIG_FILES([test/Makefile])
AC_CONFIG_FILES([Makefile])
dnl Output the generated config.status script.
AC_OUTPUT
diff --git a/debian/control b/debian/control
index e8cdf507..d5eb1771 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: admin
Priority: optional
Maintainer: Debian buildd-tools Developers <buildd-tools-devel@lists.alioth.debian.org>
Uploaders: Michael Banck <mbanck@debian.org>, Roger Leigh <rleigh@debian.org>, Francesco Paolo Lovergine <frankie@debian.org>
-Build-Depends: debhelper (>= 4.0.0), autotools-dev, libpam0g-dev, libglib2.0-dev, uuid-dev, liblockdev1-dev (>= 1.0.2-1), libboost-dev, libboost-program-options-dev, gettext
+Build-Depends: debhelper (>= 4.0.0), autotools-dev, libpam0g-dev, libglib2.0-dev, uuid-dev, liblockdev1-dev (>= 1.0.2-1), libboost-dev, libboost-program-options-dev, gettext, libcppunit-dev
Standards-Version: 3.6.2
Package: schroot
diff --git a/debian/rules b/debian/rules
index df15dccf..9a5f49b9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -21,7 +21,6 @@ endif
config.status: configure
dh_testdir
- # Add here commands to configure the package.
CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib --localstatedir=/var --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
@@ -30,9 +29,7 @@ build: build-stamp
build-stamp: config.status
dh_testdir
- # Add here commands to compile the package.
- $(MAKE)
- #docbook-to-man debian/schroot.sgml > schroot.1
+ $(MAKE) all check
touch build-stamp
@@ -41,7 +38,6 @@ clean:
dh_testroot
rm -f build-stamp
- # Add here commands to clean up after the build process.
-$(MAKE) distclean
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
cp -f /usr/share/misc/config.sub config.sub
@@ -59,7 +55,6 @@ install: build
dh_clean -k
dh_installdirs
- # Add here commands to install the package into debian/schroot.
$(MAKE) install DESTDIR=$(CURDIR)/debian/schroot
rm -rf $(CURDIR)/debian/schroot/usr/share/gtk-doc
mkdir -p $(CURDIR)/debian/schroot/usr/share/lintian/overrides
@@ -90,4 +85,4 @@ binary-arch: build install
dh_builddeb
binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install
+.PHONY: build clean binary-indep binary-arch binary install
diff --git a/po/POTFILES.in b/po/POTFILES.in
index aef92a60..c0402375 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -16,7 +16,10 @@ schroot/sbuild-chroot-plain.cc
schroot/sbuild-chroot-plain.h
schroot/sbuild-config.cc
schroot/sbuild-config.h
+schroot/sbuild-environment.cc
+schroot/sbuild-environment.h
schroot/sbuild-error.h
+schroot/sbuild.h
schroot/sbuild-i18n.h
schroot/sbuild-keyfile.cc
schroot/sbuild-keyfile.h
@@ -32,7 +35,8 @@ schroot/sbuild-types.h
schroot/sbuild-util.cc
schroot/sbuild-util.h
schroot/schroot.cc
-schroot/schroot.h
schroot/schroot-options.cc
schroot/schroot-options.h
schroot/schroot-releaselock.cc
+schroot/schroot-releaselock-options.cc
+schroot/schroot-releaselock-options.h
diff --git a/po/en_GB.po b/po/en_GB.po
index 067f5811..0d3201b6 100644
--- a/po/en_GB.po
+++ b/po/en_GB.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: schroot 0.1.2\n"
"Report-Msgid-Bugs-To: Roger Leigh <rleigh@debian.org>\n"
-"POT-Creation-Date: 2005-12-28 23:59+0000\n"
+"POT-Creation-Date: 2006-01-06 15:48+0000\n"
"PO-Revision-Date: 2005-11-02 23:31+0000\n"
"Last-Translator: Roger Leigh <rleigh@debian.org>\n"
"Language-Team: English <rleigh@debian.org>\n"
@@ -15,506 +15,544 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: schroot/sbuild-auth.cc:151 schroot/sbuild-auth.cc:205
+#: schroot/sbuild-auth.cc:116 schroot/sbuild-auth.cc:170
#, fuzzy, c-format
msgid "%1%: user not found: %2%"
msgstr "%s: group not found: %s\n"
-#: schroot/sbuild-auth.cc:374
+#: schroot/sbuild-auth.cc:338
msgid "PAM error: PAM is already initialised"
msgstr ""
-#: schroot/sbuild-auth.cc:390 schroot/sbuild-auth.cc:409
-#: schroot/sbuild-auth.cc:557 schroot/sbuild-auth.cc:582
-#: schroot/sbuild-auth.cc:601 schroot/sbuild-auth.cc:620
-#: schroot/sbuild-auth.cc:639 schroot/sbuild-auth.cc:658
-#: schroot/sbuild-session.cc:658
+#: schroot/sbuild-auth.cc:354 schroot/sbuild-auth.cc:373
+#: schroot/sbuild-auth.cc:521 schroot/sbuild-auth.cc:546
+#: schroot/sbuild-auth.cc:565 schroot/sbuild-auth.cc:584
+#: schroot/sbuild-auth.cc:603 schroot/sbuild-auth.cc:622
+#: schroot/sbuild-session.cc:641
#, fuzzy, c-format
msgid "PAM error: %1%"
msgstr "PAM error: %s\n"
-#: schroot/sbuild-auth.cc:429
+#: schroot/sbuild-auth.cc:393
#, fuzzy, c-format
msgid "PAM set RUSER error: %1%"
msgstr "PAM error: %s\n"
-#: schroot/sbuild-auth.cc:440
+#: schroot/sbuild-auth.cc:404
#, fuzzy, c-format
msgid "Failed to get hostname: %1%"
msgstr "failed to stat file: %s"
-#: schroot/sbuild-auth.cc:449
+#: schroot/sbuild-auth.cc:413
#, fuzzy, c-format
msgid "PAM set RHOST error: %1%"
msgstr "PAM error: %s\n"
-#: schroot/sbuild-auth.cc:464
+#: schroot/sbuild-auth.cc:428
#, fuzzy, c-format
msgid "PAM set TTY error: %1%"
msgstr "PAM error: %s\n"
-#: schroot/sbuild-auth.cc:478
+#: schroot/sbuild-auth.cc:442
#, fuzzy, c-format
msgid "PAM set USER error: %1%"
msgstr "PAM error: %s\n"
-#: schroot/sbuild-auth.cc:491
+#: schroot/sbuild-auth.cc:455
#, c-format
msgid "PAM authentication failed: %1%"
msgstr ""
-#: schroot/sbuild-auth.cc:501
+#: schroot/sbuild-auth.cc:465
#, c-format
msgid "You do not have permission to access the %1% service."
msgstr ""
-#: schroot/sbuild-auth.cc:504
+#: schroot/sbuild-auth.cc:468
msgid "This failure will be reported."
msgstr ""
-#: schroot/sbuild-auth.cc:509
+#: schroot/sbuild-auth.cc:473
msgid "access not authorised"
msgstr ""
-#: schroot/sbuild-auth-conv-tty.cc:132
+#: schroot/sbuild-auth-conv-tty.cc:128
msgid "Timed out"
msgstr ""
-#: schroot/sbuild-auth-conv-tty.cc:139
+#: schroot/sbuild-auth-conv-tty.cc:135
msgid "Time is running out..."
msgstr ""
-#: schroot/sbuild-auth-conv-tty.cc:168
+#: schroot/sbuild-auth-conv-tty.cc:164
#, fuzzy
msgid "Failed to get terminal settings"
msgstr "Failed to drop root permissions.\n"
-#: schroot/sbuild-auth-conv-tty.cc:280
+#: schroot/sbuild-auth-conv-tty.cc:276
#, c-format
msgid "Unsupported conversation type %1%"
msgstr ""
-#: schroot/sbuild-chroot-block-device.cc:132
-#: schroot/sbuild-chroot-lvm-snapshot.cc:147
+#: schroot/sbuild-chroot-block-device.cc:134
+#: schroot/sbuild-chroot-lvm-snapshot.cc:145
#, fuzzy, c-format
msgid "%1% chroot: failed to stat device %2%: %3%"
msgstr "%s: failed to stat file: %s"
-#: schroot/sbuild-chroot-block-device.cc:138
+#: schroot/sbuild-chroot-block-device.cc:140
#, fuzzy, c-format
msgid "%1% chroot: %2% is not a block device"
msgstr "%s chroot: property ‘%s’ is not user-settable"
-#: schroot/sbuild-chroot-block-device.cc:153
-#: schroot/sbuild-chroot-lvm-snapshot.cc:173
+#: schroot/sbuild-chroot-block-device.cc:155
+#: schroot/sbuild-chroot-lvm-snapshot.cc:171
#, fuzzy, c-format
msgid "%1%: failed to lock device: %2%"
msgstr "%s: failed to stat file: %s"
-#: schroot/sbuild-chroot-block-device.cc:166
-#: schroot/sbuild-chroot-lvm-snapshot.cc:186
+#: schroot/sbuild-chroot-block-device.cc:168
+#: schroot/sbuild-chroot-lvm-snapshot.cc:184
#, fuzzy, c-format
msgid "%1%: failed to unlock device: %2%"
msgstr "%s: failed to stat file: %s"
-#: schroot/sbuild-chroot-block-device.cc:186
+#: schroot/sbuild-chroot-block-device.cc:188
#, fuzzy
msgid "Device"
msgstr "Mount Device"
-#: schroot/sbuild-chroot-block-device.cc:188
+#: schroot/sbuild-chroot-block-device.cc:190
#, fuzzy
msgid "Mount Options"
msgstr "Mount Location"
-#: schroot/sbuild-chroot.cc:223
+#: schroot/sbuild-chroot.cc:288
msgid " --- Session ---\n"
msgstr " ——— Session ———\n"
-#: schroot/sbuild-chroot.cc:225
+#: schroot/sbuild-chroot.cc:290
msgid " --- Chroot ---\n"
msgstr " ——— Chroot ———\n"
-#: schroot/sbuild-chroot.cc:226
+#: schroot/sbuild-chroot.cc:291
msgid "Name"
msgstr "Name"
-#: schroot/sbuild-chroot.cc:227
+#: schroot/sbuild-chroot.cc:292
msgid "Description"
msgstr "Description"
-#: schroot/sbuild-chroot.cc:228
+#: schroot/sbuild-chroot.cc:293
msgid "Type"
msgstr "Type"
-#: schroot/sbuild-chroot.cc:229
+#: schroot/sbuild-chroot.cc:294
msgid "Priority"
msgstr "Priority"
-#: schroot/sbuild-chroot.cc:230
+#: schroot/sbuild-chroot.cc:295
msgid "Groups"
msgstr "Groups"
-#: schroot/sbuild-chroot.cc:231
+#: schroot/sbuild-chroot.cc:296
msgid "Root Groups"
msgstr "Root Groups"
-#: schroot/sbuild-chroot.cc:232
+#: schroot/sbuild-chroot.cc:297
msgid "Aliases"
msgstr "Aliases"
-#: schroot/sbuild-chroot.cc:233
+#: schroot/sbuild-chroot.cc:298
msgid "Run Setup Scripts"
msgstr "Run Setup Scripts"
-#: schroot/sbuild-chroot.cc:235
+#: schroot/sbuild-chroot.cc:299
msgid "Run Session Scripts"
msgstr "Run Session Scripts"
-#: schroot/sbuild-chroot.cc:241
+#: schroot/sbuild-chroot.cc:304
msgid "Mount Location"
msgstr "Mount Location"
-#: schroot/sbuild-chroot.cc:244
+#: schroot/sbuild-chroot.cc:307
msgid "Mount Device"
msgstr "Mount Device"
-#: schroot/sbuild-chroot.h:392
+#: schroot/sbuild-chroot.h:413
msgid "true"
msgstr ""
-#: schroot/sbuild-chroot.h:394
+#: schroot/sbuild-chroot.h:415
msgid "false"
msgstr ""
-#: schroot/sbuild-chroot-lvm-snapshot.cc:141
+#: schroot/sbuild-chroot-lvm-snapshot.cc:139
#, c-format
msgid "%1% chroot: device name not set"
msgstr ""
-#: schroot/sbuild-chroot-lvm-snapshot.cc:153
+#: schroot/sbuild-chroot-lvm-snapshot.cc:151
#, fuzzy, c-format
msgid "%1% chroot: %2% is not a block device\n"
msgstr "%s chroot: property ‘%s’ is not user-settable"
-#: schroot/sbuild-chroot-lvm-snapshot.cc:214
+#: schroot/sbuild-chroot-lvm-snapshot.cc:212
#, fuzzy, c-format
msgid "%1%: failed to create session file: %2%\n"
msgstr "%s: failed to stat file: %s"
-#: schroot/sbuild-chroot-lvm-snapshot.cc:231
+#: schroot/sbuild-chroot-lvm-snapshot.cc:230
#, fuzzy, c-format
msgid "%1%: lock acquisition failure: %2%\n"
msgstr "%s: lock acquisition failure: %s\n"
-#: schroot/sbuild-chroot-lvm-snapshot.cc:244
+#: schroot/sbuild-chroot-lvm-snapshot.cc:243
#, fuzzy, c-format
msgid "%1%: lock discard failure: %2%\n"
msgstr "%s: lock discard failure: %s\n"
-#: schroot/sbuild-chroot-lvm-snapshot.cc:253
+#: schroot/sbuild-chroot-lvm-snapshot.cc:252
#, fuzzy, c-format
msgid "%1%: failed to unlink session file: %2%\n"
msgstr "%s: failed to stat file: %s"
-#: schroot/sbuild-chroot-lvm-snapshot.cc:272
+#: schroot/sbuild-chroot-lvm-snapshot.cc:271
#, fuzzy
msgid "LVM Snapshot Device"
msgstr "Mount Device"
-#: schroot/sbuild-chroot-lvm-snapshot.cc:275
+#: schroot/sbuild-chroot-lvm-snapshot.cc:274
#, fuzzy
msgid "LVM Snapshot Options"
msgstr "Session Options"
-#: schroot/sbuild-chroot-plain.cc:111
+#: schroot/sbuild-chroot-plain.cc:112
#, fuzzy
msgid "Location"
msgstr "Mount Location"
-#: schroot/sbuild-config.cc:94
+#: schroot/sbuild-config.cc:55 schroot/sbuild-config.cc:100
+#, fuzzy, c-format
+msgid "%1%: failed to stat file: %2%"
+msgstr "%s: failed to stat file: %s"
+
+#: schroot/sbuild-config.cc:86
#, fuzzy, c-format
msgid "%1%: failed to open directory: %2%"
msgstr "%s: failed to open directory: %s\n"
-#: schroot/sbuild-config.cc:108 schroot/sbuild-config.cc:118
+#: schroot/sbuild-config.cc:110
#, fuzzy, c-format
-msgid "%1%: failed to stat file: %2%"
-msgstr "%s: failed to stat file: %s"
+msgid "%1%: not a regular file"
+msgstr "not a regular file"
-#: schroot/sbuild-config.cc:214 schroot/schroot.cc:103
+#: schroot/sbuild-config.cc:211 schroot/schroot.cc:94
#, fuzzy, c-format
msgid "%1%: No such chroot"
msgstr "%s: No such chroot\n"
-#: schroot/sbuild-config.cc:242
+#: schroot/sbuild-config.cc:239
#, fuzzy, c-format
msgid "failed to stat file: %1%"
msgstr "failed to stat file: %s"
-#: schroot/sbuild-config.cc:249
+#: schroot/sbuild-config.cc:246
msgid "not owned by user root"
msgstr "not owned by user root"
-#: schroot/sbuild-config.cc:254
+#: schroot/sbuild-config.cc:251
#, fuzzy
msgid "others have write permission: "
msgstr "others have write permission"
-#: schroot/sbuild-config.cc:259
+#: schroot/sbuild-config.cc:256
#, fuzzy
msgid "not a regular file: "
msgstr "not a regular file"
-#: schroot/sbuild-config.cc:279
+#: schroot/sbuild-config.cc:276
#, fuzzy, c-format
msgid "%1%: failed to load configuration: %2%"
msgstr "%s: failed to load configuration: %s\n"
-#: schroot/sbuild-config.cc:292
+#: schroot/sbuild-config.cc:289
#, fuzzy, c-format
msgid "%1%: lock acquisition failure: %2%"
msgstr "%s: lock acquisition failure: %s\n"
-#: schroot/sbuild-config.cc:304
+#: schroot/sbuild-config.cc:301
#, fuzzy, c-format
msgid "%1%: security failure: %2%"
msgstr "%s: security failure: %s\n"
-#: schroot/sbuild-config.cc:324
+#: schroot/sbuild-config.cc:322
#, fuzzy, c-format
msgid "%1%: lock discard failure: %2%"
msgstr "%s: lock discard failure: %s\n"
-#: schroot/sbuild-keyfile.cc:42
+#: schroot/sbuild-config.cc:331
+#, fuzzy, c-format
+msgid "%1%: failed to close configuration: %2%"
+msgstr "%s: failed to load configuration: %s\n"
+
+#: schroot/sbuild-config.cc:362
+#, c-format
+msgid "%1% chroot: Could not create chroot"
+msgstr ""
+
+#: schroot/sbuild-keyfile.cc:43
#, c-format
msgid "Can't open configuration file %1%"
msgstr ""
-#: schroot/sbuild-keyfile.h:315
+#: schroot/sbuild-keyfile.cc:206
+#, c-format
+msgid "%1% chroot: A required parameter \"%2%\" is missing."
+msgstr ""
+
+#: schroot/sbuild-keyfile.cc:220
+#, c-format
+msgid "%1% chroot: A deprecated parameter \"%2%\" has been specified."
+msgstr ""
+
+#: schroot/sbuild-keyfile.cc:224
+msgid "This option will be removed in the future."
+msgstr ""
+
+#: schroot/sbuild-keyfile.cc:228
+#, c-format
+msgid "%1% chroot: An obsolete parameter \"%2%\" has been specified."
+msgstr ""
+
+#: schroot/sbuild-keyfile.cc:232
+msgid "This option has been removed, and no longer has any effect."
+msgstr ""
+
+#: schroot/sbuild-keyfile.h:433
#, c-format
msgid "Line %1%: invalid group entry: %2%"
msgstr ""
-#: schroot/sbuild-keyfile.h:341
+#: schroot/sbuild-keyfile.h:459
#, c-format
msgid "Line %1%: invalid line: %2%"
msgstr ""
-#: schroot/sbuild-keyfile.h:347
+#: schroot/sbuild-keyfile.h:465
#, c-format
msgid "Line %1%: no key specified: %2%"
msgstr ""
-#: schroot/sbuild-lock.cc:79
+#: schroot/sbuild-lock.cc:76
#, fuzzy, c-format
msgid "failed to set timeout handler: %1%"
msgstr "failed to stat file: %s"
-#: schroot/sbuild-lock.cc:100
+#: schroot/sbuild-lock.cc:97
#, fuzzy, c-format
msgid "failed to set timeout: %1%"
msgstr "failed to stat file: %s"
-#: schroot/sbuild-lock.cc:116
+#: schroot/sbuild-lock.cc:113
#, fuzzy, c-format
msgid "failed to unset timeout: %1%"
msgstr "failed to stat file: %s"
-#: schroot/sbuild-lock.cc:166
+#: schroot/sbuild-lock.cc:164
#, fuzzy, c-format
msgid "failed to acquire lock (timeout after %1% seconds)"
msgstr "failed to stat file: %s"
-#: schroot/sbuild-lock.cc:172
+#: schroot/sbuild-lock.cc:170
#, fuzzy, c-format
msgid "failed to acquire lock: %1%"
msgstr "failed to stat file: %s"
-#: schroot/sbuild-lock.cc:232
+#: schroot/sbuild-lock.cc:230
msgid "failed to acquire device lock"
msgstr ""
-#: schroot/sbuild-lock.cc:240
+#: schroot/sbuild-lock.cc:238
#, fuzzy
msgid "failed to test device lock"
msgstr "failed to stat file: %s"
-#: schroot/sbuild-lock.cc:244
+#: schroot/sbuild-lock.cc:242
#, fuzzy, c-format
msgid "failed to release device lock held by pid %1%"
msgstr "%s: failed to open directory: %s\n"
-#: schroot/sbuild-lock.cc:253
+#: schroot/sbuild-lock.cc:251
msgid "failed to release device lock"
msgstr ""
-#: schroot/sbuild-lock.cc:262
+#: schroot/sbuild-lock.cc:260
#, fuzzy, c-format
msgid ""
"failed to acquire device lock held by pid %1% (timeout after %2% seconds)"
msgstr "%s: failed to open directory: %s\n"
-#: schroot/sbuild-lock.cc:264
+#: schroot/sbuild-lock.cc:262
#, fuzzy, c-format
msgid ""
"failed to release device lock held by pid %1% (timeout after %2% seconds)"
msgstr "%s: failed to open directory: %s\n"
-#: schroot/sbuild-session.cc:128
+#: schroot/sbuild-session.cc:106
#, fuzzy, c-format
msgid "%1%: group not found"
msgstr "%s: group not found\n"
-#: schroot/sbuild-session.cc:130
+#: schroot/sbuild-session.cc:108
#, fuzzy, c-format
msgid "%1%: group not found: %2%"
msgstr "%s: group not found: %s\n"
-#: schroot/sbuild-session.cc:146
+#: schroot/sbuild-session.cc:124
#, fuzzy, c-format
msgid "can't get supplementary group count: %1%"
msgstr "can't get supplementary group count: %s\n"
-#: schroot/sbuild-session.cc:156
+#: schroot/sbuild-session.cc:134
#, fuzzy, c-format
msgid "can't get supplementary groups: %1%"
msgstr "can't get supplementary groups: %s\n"
-#: schroot/sbuild-session.cc:276
+#: schroot/sbuild-session.cc:258
#, fuzzy, c-format
msgid "No chroot found matching alias '%1%'"
msgstr "No chroot found matching alias ‘%s’"
-#: schroot/sbuild-session.cc:355
+#: schroot/sbuild-session.cc:337
#, fuzzy, c-format
msgid "%1%: Failed to find chroot"
msgstr "%s: Failed to find chroot"
-#: schroot/sbuild-session.cc:507
+#: schroot/sbuild-session.cc:489
#, fuzzy, c-format
msgid "Chroot setup failed to lock chroot: %1%"
msgstr "Chroot setup failed to lock chroot: %s"
-#: schroot/sbuild-session.cc:564
+#: schroot/sbuild-session.cc:545
#, fuzzy, c-format
msgid "Invalid verbosity level: %1%, falling back to \"normal\""
msgstr "Invalid verbosity level: %d, falling back to “normal”"
-#: schroot/sbuild-session.cc:583 schroot/sbuild-session.cc:874
+#: schroot/sbuild-session.cc:564 schroot/sbuild-session.cc:856
#, fuzzy, c-format
msgid "Failed to fork child: %1%"
msgstr "Failed to fork child: %s"
-#: schroot/sbuild-session.cc:598 schroot/sbuild-session.cc:810
+#: schroot/sbuild-session.cc:582 schroot/sbuild-session.cc:792
#, fuzzy, c-format
msgid "Could not exec \"%1%\": %2%"
msgstr "Could not exec “%s”: %s\n"
-#: schroot/sbuild-session.cc:616
+#: schroot/sbuild-session.cc:600
#, fuzzy, c-format
msgid "Chroot setup failed to unlock chroot: %1%"
msgstr "Chroot setup failed to unlock chroot: %s"
-#: schroot/sbuild-session.cc:623
+#: schroot/sbuild-session.cc:607
#, fuzzy, c-format
msgid "Chroot setup failed during chroot \"%1%\" stage"
msgstr "Chroot setup failed during chroot %s"
-#: schroot/sbuild-session.cc:666
+#: schroot/sbuild-session.cc:649
#, fuzzy, c-format
msgid "Could not set gid to '%1%'"
msgstr "Could not set gid to ‘%lu’\n"
-#: schroot/sbuild-session.cc:672
+#: schroot/sbuild-session.cc:655
#, fuzzy
msgid "Could not set supplementary group IDs"
msgstr "Could not set supplementary group IDs\n"
-#: schroot/sbuild-session.cc:679
+#: schroot/sbuild-session.cc:662
#, fuzzy, c-format
msgid "Could not chdir to '%1%': %2%"
msgstr "Could not chdir to ‘%s’: %s\n"
-#: schroot/sbuild-session.cc:686
+#: schroot/sbuild-session.cc:669
#, fuzzy, c-format
msgid "Could not chroot to '%1%': %2%"
msgstr "Could not chroot to ‘%s’: %s\n"
-#: schroot/sbuild-session.cc:695
+#: schroot/sbuild-session.cc:678
#, fuzzy, c-format
msgid "Could not set uid to '%1%'"
msgstr "Could not set uid to ‘%lu’\n"
-#: schroot/sbuild-session.cc:701
+#: schroot/sbuild-session.cc:684
#, fuzzy
msgid "Failed to drop root permissions."
msgstr "Failed to drop root permissions.\n"
-#: schroot/sbuild-session.cc:709
+#: schroot/sbuild-session.cc:692
#, fuzzy, c-format
msgid "warning: Could not chdir to '%1%': %2%"
msgstr "warning: Could not chdir to ‘%s’: %s\n"
-#: schroot/sbuild-session.cc:766
+#: schroot/sbuild-session.cc:745
#, fuzzy, c-format
msgid "[%1% chroot] Running login shell: \"%2%\""
msgstr "[%s chroot] Running login shell: “%s”\n"
-#: schroot/sbuild-session.cc:767
+#: schroot/sbuild-session.cc:746
#, fuzzy, c-format
msgid "[%1% chroot] Running shell: \"%2%\""
msgstr "[%s chroot] Running shell: “%s”\n"
-#: schroot/sbuild-session.cc:773
+#: schroot/sbuild-session.cc:752
#, fuzzy, c-format
msgid "[%1% chroot] (%2%->%3%) Running login shell: \"%4%\""
msgstr "[%s chroot] (%s→%s) Running login shell: “%s”\n"
-#: schroot/sbuild-session.cc:774
+#: schroot/sbuild-session.cc:753
#, fuzzy, c-format
msgid "[%1% chroot] (%2%->%3%) Running shell: \"%4%\""
msgstr "[%s chroot] (%s→%s) Running shell: “%s”\n"
-#: schroot/sbuild-session.cc:795
+#: schroot/sbuild-session.cc:774
#, fuzzy, c-format
msgid "[%1% chroot] Running command: \"%2%\""
msgstr "[%s chroot] Running command: “%s”\n"
-#: schroot/sbuild-session.cc:799
+#: schroot/sbuild-session.cc:778
#, fuzzy, c-format
msgid "[%1% chroot] (%2%->%3%) Running command: \"%4%\""
msgstr "[%s chroot] (%s→%s) Running command: “%s”\n"
-#: schroot/sbuild-session.cc:828
+#: schroot/sbuild-session.cc:810
#, fuzzy, c-format
msgid "wait for child failed: %1%"
msgstr "wait for child failed: %s\n"
-#: schroot/sbuild-session.cc:846
+#: schroot/sbuild-session.cc:828
#, fuzzy, c-format
msgid "Child terminated by signal %1%"
msgstr "Child terminated by signal ‘%s’"
-#: schroot/sbuild-session.cc:851
+#: schroot/sbuild-session.cc:833
msgid "Child dumped core"
msgstr "Child dumped core"
-#: schroot/sbuild-session.cc:853
+#: schroot/sbuild-session.cc:835
msgid "Child exited abnormally (reason unknown; not a signal or core dump)"
msgstr "Child exited abnormally (reason unknown; not a signal or core dump)"
-#: schroot/sbuild-session.cc:860
+#: schroot/sbuild-session.cc:842
#, fuzzy, c-format
msgid "Child exited abnormally with status '%1%'"
msgstr "Child exited abnormally with status ‘%d’"
-#: schroot/schroot.cc:56
+#: schroot/schroot.cc:47
#, fuzzy, c-format
msgid "schroot (Debian sbuild) %1%\n"
msgstr "schroot (Debian sbuild) %s\n"
-#: schroot/schroot.cc:57 schroot/schroot-releaselock.cc:129
+#: schroot/schroot.cc:48 schroot/schroot-releaselock.cc:56
msgid ""
"Written by Roger Leigh\n"
"\n"
@@ -522,11 +560,12 @@ msgstr ""
"Written by Roger Leigh\n"
"\n"
-#: schroot/schroot.cc:58 schroot/schroot-releaselock.cc:130
-msgid "Copyright (C) 2004-2005 Roger Leigh\n"
+#: schroot/schroot.cc:49 schroot/schroot-releaselock.cc:57
+#, fuzzy
+msgid "Copyright (C) 2004-2006 Roger Leigh\n"
msgstr "Copyright © 2004-2005 Roger Leigh\n"
-#: schroot/schroot.cc:59 schroot/schroot-releaselock.cc:131
+#: schroot/schroot.cc:50 schroot/schroot-releaselock.cc:58
msgid ""
"This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
@@ -534,199 +573,235 @@ msgstr ""
"This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
-#: schroot/schroot.cc:164
+#: schroot/schroot.cc:160
+#, fuzzy, c-format
+msgid "No chroots are defined in %1% or %2%"
+msgstr "No chroots are defined in %s\n"
+
+#: schroot/schroot.cc:167
#, fuzzy, c-format
msgid "No chroots are defined in %1%"
msgstr "No chroots are defined in %s\n"
-#: schroot/schroot.cc:181
+#: schroot/schroot.cc:184
#, fuzzy, c-format
msgid "The specified chroots are not defined in %1%"
msgstr "The specified chroots are not defined in %s\n"
-#: schroot/schroot.cc:198
+#: schroot/schroot.cc:201
#, fuzzy
msgid "Only one chroot may be specified when beginning a session"
msgstr "Only one chroot may be specified when beginning a session\n"
-#: schroot/schroot.cc:238
+#: schroot/schroot.cc:248
#, fuzzy, c-format
msgid "Session failure: %1%"
msgstr "Session failure: %s\n"
-#: schroot/schroot-options.cc:76 schroot/schroot-releaselock.cc:85
+#: schroot/schroot-options.cc:59 schroot/schroot-releaselock-options.cc:44
msgid "General options"
msgstr ""
-#: schroot/schroot-options.cc:79 schroot/schroot-releaselock.cc:87
+#: schroot/schroot-options.cc:62 schroot/schroot-releaselock-options.cc:46
#, fuzzy
msgid "Show help options"
msgstr "Show less output"
-#: schroot/schroot-options.cc:81 schroot/schroot-releaselock.cc:89
+#: schroot/schroot-options.cc:64 schroot/schroot-releaselock-options.cc:48
msgid "Print version information"
msgstr "Print version information"
-#: schroot/schroot-options.cc:83
+#: schroot/schroot-options.cc:66
msgid "Show less output"
msgstr "Show less output"
-#: schroot/schroot-options.cc:85
+#: schroot/schroot-options.cc:68
msgid "Show more output"
msgstr "Show more output"
-#: schroot/schroot-options.cc:87
+#: schroot/schroot-options.cc:70
msgid "List available chroots"
msgstr "List available chroots"
-#: schroot/schroot-options.cc:89
+#: schroot/schroot-options.cc:72
#, fuzzy
msgid "Show information about selected chroots"
msgstr "Show information about chroot"
-#: schroot/schroot-options.cc:91
+#: schroot/schroot-options.cc:74
msgid "Chroot selection"
msgstr ""
-#: schroot/schroot-options.cc:94
+#: schroot/schroot-options.cc:77
msgid "Use specified chroot"
msgstr "Use specified chroot"
-#: schroot/schroot-options.cc:96
+#: schroot/schroot-options.cc:79
msgid "Select all chroots and active sessions"
msgstr "Select all chroots and active sessions"
-#: schroot/schroot-options.cc:98
+#: schroot/schroot-options.cc:81
msgid "Select all chroots"
msgstr "Select all chroots"
-#: schroot/schroot-options.cc:100
+#: schroot/schroot-options.cc:83
msgid "Select all active sessions"
msgstr "Select all active sessions"
-#: schroot/schroot-options.cc:102
+#: schroot/schroot-options.cc:85
#, fuzzy
msgid "Chroot environment"
msgstr "Preserve user environment"
-#: schroot/schroot-options.cc:105
+#: schroot/schroot-options.cc:88
msgid "Username (default current user)"
msgstr "Username (default current user)"
-#: schroot/schroot-options.cc:107
+#: schroot/schroot-options.cc:90
msgid "Preserve user environment"
msgstr "Preserve user environment"
-#: schroot/schroot-options.cc:109
+#: schroot/schroot-options.cc:92
#, fuzzy
msgid "Session management"
msgstr "Session management options"
-#: schroot/schroot-options.cc:112
+#: schroot/schroot-options.cc:95
#, fuzzy
msgid "Begin a session; returns a session ID"
msgstr "Begin a session; returns a session UUID"
-#: schroot/schroot-options.cc:114
+#: schroot/schroot-options.cc:97
#, fuzzy
msgid "Recover an existing session"
msgstr "Run an existing session"
-#: schroot/schroot-options.cc:116
+#: schroot/schroot-options.cc:99
msgid "Run an existing session"
msgstr "Run an existing session"
-#: schroot/schroot-options.cc:118
+#: schroot/schroot-options.cc:101
msgid "End an existing session"
msgstr "End an existing session"
-#: schroot/schroot-options.cc:120
+#: schroot/schroot-options.cc:103
msgid "Force operation, even if it fails"
msgstr "Force operation, even if it fails"
-#: schroot/schroot-options.cc:122
+#: schroot/schroot-options.cc:105
#, fuzzy
msgid "Hidden options"
msgstr "Session Options"
-#: schroot/schroot-options.cc:125
+#: schroot/schroot-options.cc:108
msgid "Command to run"
msgstr ""
-#: schroot/schroot-options.cc:141 schroot/schroot-releaselock.cc:109
+#: schroot/schroot-options.cc:124 schroot/schroot-releaselock-options.cc:68
msgid "Usage:"
msgstr ""
-#: schroot/schroot-options.cc:142
+#: schroot/schroot-options.cc:125
#, fuzzy
msgid " schroot [OPTION...] - run command or shell in a chroot"
msgstr "- run command or shell in a chroot"
-#: schroot/schroot-options.cc:182
+#: schroot/schroot-options.cc:165
#, fuzzy
-msgid "--quiet and --verbose may not be used at the same time!"
+msgid "--quiet and --verbose may not be used at the same time"
msgstr ""
"--quiet and --verbose may not be used at the same time!\n"
"Using verbose output.\n"
-#: schroot/schroot-options.cc:184
-msgid "Using verbose output."
+#: schroot/schroot-options.cc:167
+msgid "Using verbose output"
msgstr ""
-#: schroot/schroot-options.cc:227
-msgid "Only one session operation may be specified"
+#: schroot/schroot-options.cc:173
+#, fuzzy
+msgid "--chroot and --all may not be used at the same time"
msgstr ""
+"--quiet and --verbose may not be used at the same time!\n"
+"Using verbose output.\n"
-#: schroot/schroot-releaselock.cc:91
+#: schroot/schroot-options.cc:175
+msgid "Using --chroots only"
+msgstr ""
+
+#: schroot/schroot-options.cc:204
#, fuzzy
-msgid "Lock options"
-msgstr "Mount Location"
+msgid ""
+"Only one chroot may be specified when recovering, running or ending a session"
+msgstr "Only one chroot may be specified when beginning a session\n"
-#: schroot/schroot-releaselock.cc:94
-msgid "Device to unlock (full path)"
-msgstr ""
+#: schroot/schroot-options.cc:215
+#, fuzzy
+msgid "Only one chroot may be specified when begining a session"
+msgstr "Only one chroot may be specified when beginning a session\n"
-#: schroot/schroot-releaselock.cc:96
-msgid "Process ID owning the lock"
+#: schroot/schroot-options.cc:233
+msgid "--chroot may not be used with --list"
msgstr ""
-#: schroot/schroot-releaselock.cc:110
-msgid " schroot-releaselock [OPTION...] - release a device lock"
+#: schroot/schroot-options.cc:253
+msgid "Unknown action specified"
msgstr ""
-#: schroot/schroot-releaselock.cc:128
+#: schroot/schroot-options.cc:265
+#, fuzzy
+msgid "Only one action may be specified"
+msgstr "Only one chroot may be specified when beginning a session\n"
+
+#: schroot/schroot-releaselock.cc:55
#, fuzzy, c-format
msgid "schroot-releaselock (Debian sbuild) %1%\n"
msgstr "schroot (Debian sbuild) %s\n"
-#: schroot/schroot-releaselock.cc:171
+#: schroot/schroot-releaselock.cc:103
msgid "No device specified"
msgstr ""
-#: schroot/schroot-releaselock.cc:177
+#: schroot/schroot-releaselock.cc:109
msgid "No pid specified; forcing release of lock"
msgstr ""
-#: schroot/schroot-releaselock.cc:186
+#: schroot/schroot-releaselock.cc:118
#, fuzzy, c-format
msgid "Failed to stat device %1%: %2%"
msgstr "failed to stat file: %s"
-#: schroot/schroot-releaselock.cc:194
+#: schroot/schroot-releaselock.cc:126
#, fuzzy, c-format
msgid "%1% is not a block device"
msgstr "%s chroot: property ‘%s’ is not user-settable"
-#: schroot/schroot-releaselock.cc:202
+#: schroot/schroot-releaselock.cc:134
#, fuzzy, c-format
msgid "%1%: failed to release device lock"
msgstr "%s: failed to open directory: %s\n"
-#: schroot/schroot-releaselock.cc:209
+#: schroot/schroot-releaselock.cc:141
#, fuzzy, c-format
msgid "%1%: failed to release device lock owned by pid %2%"
msgstr "%s: failed to open directory: %s\n"
+#: schroot/schroot-releaselock-options.cc:50
+#, fuzzy
+msgid "Lock options"
+msgstr "Mount Location"
+
+#: schroot/schroot-releaselock-options.cc:53
+msgid "Device to unlock (full path)"
+msgstr ""
+
+#: schroot/schroot-releaselock-options.cc:55
+msgid "Process ID owning the lock"
+msgstr ""
+
+#: schroot/schroot-releaselock-options.cc:69
+msgid " schroot-releaselock [OPTION...] - release a device lock"
+msgstr ""
+
#, fuzzy
#~ msgid "Error parsing options: %1%"
#~ msgstr "Error parsing options: %s\n"
diff --git a/schroot/Makefile.am b/schroot/Makefile.am
index 8b85c63a..7be6b504 100644
--- a/schroot/Makefile.am
+++ b/schroot/Makefile.am
@@ -25,7 +25,6 @@ SUBDIRS = pam run setup
localedir = $(datadir)/locale
pkglibexecdir = $(SCHROOT_LIBEXEC_DIR)
-AM_CFLAGS = -std=c99 $(SCHROOT_CFLAGS)
AM_CXXFLAGS = $(SCHROOT_CFLAGS) -pedantic -Wall -Wcast-align -Wextra -Wwrite-strings -Wswitch-default -Wcast-qual -Wunused-variable -Wredundant-decls -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Wold-style-cast -Woverloaded-virtual -fstrict-aliasing
# -Weffc++ causes too many warnings in standard headers.
diff --git a/schroot/sbuild-util.cc b/schroot/sbuild-util.cc
index 3102e737..a66ca8b8 100644
--- a/schroot/sbuild-util.cc
+++ b/schroot/sbuild-util.cc
@@ -151,7 +151,7 @@ sbuild::find_program_in_path(std::string const& program)
return program;
char *path = getenv("PATH");
- string_list dirs = split_string(path, '/');
+ string_list dirs = split_string(path, ':');
for (string_list::const_iterator dir = dirs.begin();
dir != dirs.end();
diff --git a/test/.cvsignore b/test/.cvsignore
new file mode 100755
index 00000000..1bc4d25f
--- /dev/null
+++ b/test/.cvsignore
@@ -0,0 +1,9 @@
+.deps
+.libs
+Makefile
+Makefile.in
+*.la
+*.lo
+*.gch
+sbuild-util
+
diff --git a/test/Makefile.am b/test/Makefile.am
new file mode 100644
index 00000000..d9fb4743
--- /dev/null
+++ b/test/Makefile.am
@@ -0,0 +1,34 @@
+# schroot Makefile template
+#
+#
+# Copyright © 2004-2006 Roger Leigh <rleigh@debian.org>
+#
+# schroot 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.
+#
+# schroot 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
+#
+#####################################################################
+
+AM_CXXFLAGS = $(SCHROOT_CFLAGS) $(CPPUNIT_CFLAGS) -pedantic -Wall -Wcast-align -Wextra -Wwrite-strings -Wswitch-default -Wcast-qual -Wunused-variable -Wredundant-decls -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Wold-style-cast -Woverloaded-virtual -fstrict-aliasing
+# -Weffc++ causes too many warnings in standard headers.
+
+if USE_UNIT_TESTS
+noinst_PROGRAMS = \
+ sbuild-util
+
+TESTS = $(noinst_PROGRAMS)
+endif
+
+sbuild_util_SOURCES = testmain.cc sbuild-util.cc
+sbuild_util_LDADD = ../schroot/libsbuild.la $(CPPUNIT_LIBS) \ No newline at end of file
diff --git a/test/sbuild-util.cc b/test/sbuild-util.cc
new file mode 100644
index 00000000..f3f3bf75
--- /dev/null
+++ b/test/sbuild-util.cc
@@ -0,0 +1,75 @@
+#include <cstdlib>
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <schroot/sbuild-util.h>
+
+using namespace CppUnit;
+
+class test_util : public TestCase
+{
+ CPPUNIT_TEST_SUITE(test_util);
+ CPPUNIT_TEST(test_basename);
+ CPPUNIT_TEST(test_dirname);
+ CPPUNIT_TEST(test_string_list_to_string);
+ CPPUNIT_TEST(test_split_string);
+ CPPUNIT_TEST(test_find_program_in_path);
+ CPPUNIT_TEST_SUITE_END();
+
+public:
+ test_util()
+ {}
+
+ void test_basename()
+ {
+ CPPUNIT_ASSERT(sbuild::basename("/usr/bin/perl") == "perl");
+ CPPUNIT_ASSERT(sbuild::basename("/usr/lib") == "lib");
+ CPPUNIT_ASSERT(sbuild::basename("/usr/") == "usr");
+ CPPUNIT_ASSERT(sbuild::basename("usr") == "usr");
+ CPPUNIT_ASSERT(sbuild::basename("/") == "/");
+ CPPUNIT_ASSERT(sbuild::basename(".") == ".");
+ CPPUNIT_ASSERT(sbuild::basename("..") == "..");
+ }
+
+ void test_dirname()
+ {
+ CPPUNIT_ASSERT(sbuild::dirname("/usr/bin/perl") == "/usr/bin");
+ CPPUNIT_ASSERT(sbuild::dirname("/usr/lib") == "/usr");
+ CPPUNIT_ASSERT(sbuild::dirname("/usr/") == "/");
+ CPPUNIT_ASSERT(sbuild::dirname("usr") == ".");
+ CPPUNIT_ASSERT(sbuild::dirname("/") == "/");
+ CPPUNIT_ASSERT(sbuild::dirname(".") == ".");
+ CPPUNIT_ASSERT(sbuild::dirname("..") == ".");
+ }
+
+ void test_string_list_to_string()
+ {
+ sbuild::string_list items;
+ items.push_back("foo");
+ items.push_back("bar");
+ items.push_back("baz");
+
+ CPPUNIT_ASSERT(sbuild::string_list_to_string(items, "--") ==
+ "foo--bar--baz");
+ }
+
+ void test_split_string()
+ {
+ sbuild::string_list items =
+ sbuild::split_string("/usr/share/info", '/');
+
+ CPPUNIT_ASSERT(items.size() == 3 &&
+ items[0] == "usr" &&
+ items[1] == "share" &&
+ items[2] == "info");
+ }
+
+ void test_find_program_in_path()
+ {
+ CPPUNIT_ASSERT(sbuild::find_program_in_path("sh") == "/bin/sh");
+ CPPUNIT_ASSERT(sbuild::find_program_in_path("sed") == "/bin/sed");
+ }
+
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(test_util);
diff --git a/test/testmain.cc b/test/testmain.cc
new file mode 100644
index 00000000..144ab8fe
--- /dev/null
+++ b/test/testmain.cc
@@ -0,0 +1,20 @@
+#include <cstdlib>
+
+#include <cppunit/ui/text/TestRunner.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+
+using namespace CppUnit;
+
+int
+main(int argc,
+ char* argv[])
+{
+ TextUi::TestRunner runner;
+
+ TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
+ runner.addTest(registry.makeTest());
+
+ bool ok = runner.run();
+
+ return (ok) ? EXIT_SUCCESS : EXIT_FAILURE;
+}