>From 0a9d1313a7e47c96a47e770edac1d1435bb4c1d9 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Tue, 1 Feb 2011 14:26:19 +0100 Subject: [PATCH 5/6] canonicalize-lgpl: Add basic sanity checks for mingw. 2011-02-01 Jan Nieuwenhuizen * tests/test-canonicalize-lgpl.c (main)[__MINGW32__]: Add basic sanity checks for mingw along with debug printing to demonstrate brokenness. --- ChangeLog | 5 +++++ tests/test-canonicalize-lgpl.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 0 deletions(-) diff --git a/ChangeLog b/ChangeLog index 94a9a6a..86217e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2011-02-01 Jan Nieuwenhuizen + * tests/test-canonicalize-lgpl.c (main)[__MINGW32__]: Add basic sanity + checks for mingw along with debug printing to demonstrate brokenness. + +2011-02-01 Jan Nieuwenhuizen + * tests/test-canonicalize-lgpl.c (main)[__MINGW32__]: Skip cleanup using remove. Fixes aborting on cleanups. We do an initial cleanup anyway. diff --git a/tests/test-canonicalize-lgpl.c b/tests/test-canonicalize-lgpl.c index 49f8643..18f0005 100644 --- a/tests/test-canonicalize-lgpl.c +++ b/tests/test-canonicalize-lgpl.c @@ -104,7 +104,41 @@ main (void) } #ifdef __MINGW32__ + + /* Check basic drive letter sanity. */ + { + char cwd[PATH_MAX]; + char *test; + char *result; + + /* Check if BASE has a canonical name. */ + result = canonicalize_file_name (BASE); + fprintf (stderr, "BASE-canon: %s\n", result); + ASSERT (result != NULL); + + /* Check if BASE's canonical name is somewhat canonical. */ + ASSERT ((strchr (result, '/') == NULL) + != (strchr (result, '\\') == NULL)); + + /* Check if CWD has a canonical name. */ + getcwd (cwd, PATH_MAX); + fprintf (stderr, "CWD: %s\n", cwd); + result = canonicalize_file_name (cwd); + fprintf (stderr, "CWD-canon: %s\n", result); + ASSERT (result != NULL); + + /* Check basic drive letter sanity. */ + test = "c:/"; + result = canonicalize_file_name (test); + ASSERT (strcmp (result, test) == 0); + fprintf (stderr, "C:/-canon: %s\n", result); + result = canonicalize_file_name ("C:\\"); + ASSERT (strcmp (result, test) == 0); + fprintf (stderr, "C:\\-canon: %s\n", result); + } + return 0; + #endif /* __MINGW32__ */ /* From here on out, tests involve symlinks. */ -- 1.7.1