[network-manager-vpnc] test: fix distcheck
- From: Dan Williams <dcbw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-vpnc] test: fix distcheck
- Date: Tue, 5 Apr 2011 16:30:50 +0000 (UTC)
commit 5fb9acb7386a83a74838e1e3cf2c23e6359d4e85
Author: Dan Williams <dcbw redhat com>
Date: Tue Apr 5 11:30:47 2011 -0500
test: fix distcheck
The tests need to write somewhere, and $srcdir is read-only, so
we have to pass $builddir as well for tempfiles.
properties/tests/Makefile.am | 2 +-
properties/tests/test-import-export.c | 27 +++++++++++++++------------
2 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/properties/tests/Makefile.am b/properties/tests/Makefile.am
index b5b34ad..78b749d 100644
--- a/properties/tests/Makefile.am
+++ b/properties/tests/Makefile.am
@@ -25,7 +25,7 @@ test_import_export_LDADD = \
if WITH_TESTS
check-local: test-import-export
- $(abs_builddir)/test-import-export $(abs_srcdir)/pcf
+ $(abs_builddir)/test-import-export $(abs_srcdir)/pcf $(abs_builddir)/pcf
endif
diff --git a/properties/tests/test-import-export.c b/properties/tests/test-import-export.c
index 5a3f5b3..aa3eade 100644
--- a/properties/tests/test-import-export.c
+++ b/properties/tests/test-import-export.c
@@ -267,7 +267,7 @@ remove_secrets (NMConnection *connection)
#define BASIC_EXPORTED_NAME "basic-export-test.pcf"
static void
-test_basic_export (NMVpnPluginUiInterface *plugin, const char *dir)
+test_basic_export (NMVpnPluginUiInterface *plugin, const char *dir, const char *tmpdir)
{
NMConnection *connection;
NMConnection *reimported;
@@ -280,7 +280,7 @@ test_basic_export (NMVpnPluginUiInterface *plugin, const char *dir)
connection = get_basic_connection ("basic-export", plugin, dir, "basic.pcf");
ASSERT (connection != NULL, "basic-export", "failed to import connection");
- path = g_build_path ("/", dir, BASIC_EXPORTED_NAME, NULL);
+ path = g_build_path ("/", tmpdir, BASIC_EXPORTED_NAME, NULL);
success = nm_vpn_plugin_ui_interface_export (plugin, path, connection, &error);
if (!success) {
if (!error)
@@ -290,7 +290,7 @@ test_basic_export (NMVpnPluginUiInterface *plugin, const char *dir)
}
/* Now re-import it and compare the connections to ensure they are the same */
- reimported = get_basic_connection ("basic-export", plugin, dir, BASIC_EXPORTED_NAME);
+ reimported = get_basic_connection ("basic-export", plugin, tmpdir, BASIC_EXPORTED_NAME);
ret = unlink (path);
ASSERT (connection != NULL, "basic-export", "failed to re-import connection");
@@ -318,7 +318,10 @@ test_basic_export (NMVpnPluginUiInterface *plugin, const char *dir)
#define NAT_EXPORTED_NAME "nat-export-test.pcf"
static void
-test_nat_export (NMVpnPluginUiInterface *plugin, const char *dir, const char *nat_mode)
+test_nat_export (NMVpnPluginUiInterface *plugin,
+ const char *dir,
+ const char *tmpdir,
+ const char *nat_mode)
{
NMConnection *connection;
NMSettingVPN *s_vpn;
@@ -336,7 +339,7 @@ test_nat_export (NMVpnPluginUiInterface *plugin, const char *dir, const char *na
nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_NAT_TRAVERSAL_MODE, nat_mode);
- path = g_build_path ("/", dir, NAT_EXPORTED_NAME, NULL);
+ path = g_build_path ("/", tmpdir, NAT_EXPORTED_NAME, NULL);
success = nm_vpn_plugin_ui_interface_export (plugin, path, connection, &error);
if (!success) {
if (!error)
@@ -346,7 +349,7 @@ test_nat_export (NMVpnPluginUiInterface *plugin, const char *dir, const char *na
}
/* Now re-import it and compare the connections to ensure they are the same */
- reimported = get_basic_connection ("nat-export", plugin, dir, NAT_EXPORTED_NAME);
+ reimported = get_basic_connection ("nat-export", plugin, tmpdir, NAT_EXPORTED_NAME);
ret = unlink (path);
ASSERT (connection != NULL, "nat-export", "failed to re-import connection");
@@ -754,8 +757,8 @@ int main (int argc, char **argv)
char *basename;
NMVpnPluginUiInterface *plugin = NULL;
- if (argc != 2)
- FAIL ("args", "usage: %s <pcf path>", argv[0]);
+ if (argc != 3)
+ FAIL ("args", "usage: %s <pcf path> <tmp path>", argv[0]);
g_type_init ();
bus = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
@@ -781,10 +784,10 @@ int main (int argc, char **argv)
test_legacy_ike_port_0_import (plugin, argv[1]);
test_legacy_ike_port_1_import (plugin, argv[1]);
- test_basic_export (plugin, argv[1]);
- test_nat_export (plugin, argv[1], NM_VPNC_NATT_MODE_CISCO);
- test_nat_export (plugin, argv[1], NM_VPNC_NATT_MODE_NATT);
- test_nat_export (plugin, argv[1], NM_VPNC_NATT_MODE_NATT_ALWAYS);
+ test_basic_export (plugin, argv[1], argv[2]);
+ test_nat_export (plugin, argv[1], argv[2], NM_VPNC_NATT_MODE_CISCO);
+ test_nat_export (plugin, argv[1], argv[2], NM_VPNC_NATT_MODE_NATT);
+ test_nat_export (plugin, argv[1], argv[2], NM_VPNC_NATT_MODE_NATT_ALWAYS);
g_object_unref (plugin);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]