From cbe313b4479e09b9e0cbd3fb9e865f3f4d6843c3 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 8 Dec 2009 17:28:51 -0800 Subject: [PATCH] ifcfg-rh: fix distcheck and tests after 9e93924cca6c9f5f7fc6819babd9dd2771c1cc03 Since one test read in a file, wrote it out, and read it in again, we have to be careful of whether srcdir == builddir or not. If it doesn't, then we need to remove the written-out connection file. If it does, then we don't want to remove that written-out connection file because it's tracked by SCM. Avoid the whole problem by writing it out to a separate directory that we can always delete it from. --- .../plugins/ifcfg-rh/tests/network-scripts/Makefile.am | 3 +++ system-settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/system-settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am b/system-settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am index 0d9fee967b..80a4054a2d 100644 --- a/system-settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am +++ b/system-settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am @@ -55,3 +55,6 @@ check-local: chmod 0600 $(abs_srcdir)/$$f; \ done +# Make the special temp dir for some written connections + mkdir -p $(abs_builddir)/tmp + diff --git a/system-settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/system-settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c index 3241ebbd98..1d3b8d44a7 100644 --- a/system-settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c +++ b/system-settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c @@ -4343,9 +4343,12 @@ test_read_write_static_routes_legacy (void) NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_NEVER_DEFAULT); - /* Save the ifcfg */ + /* Save the ifcfg; use a special different scratch dir to ensure that + * we can clean up after the written connection in both the original + * source tree and for 'make distcheck'. + */ success = writer_new_connection (connection, - TEST_SCRATCH_DIR "/network-scripts/", + TEST_SCRATCH_DIR "/network-scripts/tmp", &testfile, &error); ASSERT (success == TRUE,