Revision: 2699
http://ipcop.svn.sourceforge.net/ipcop/?rev=2699&view=rev
Author: gespinasse
Date: 2009-04-12 08:10:16 +0000 (Sun, 12 Apr 2009)
Log Message:
-----------
Allow better testing than manually tweaking the code to be in the case you want
to check
On network install, to test dhcp case, boot with
install codepath=1
to test manual selection case
install codepath=2
Modified Paths:
--------------
ipcop/trunk/src/installer/installer.c
Modified: ipcop/trunk/src/installer/installer.c
===================================================================
--- ipcop/trunk/src/installer/installer.c 2009-04-11 20:39:21 UTC (rev
2698)
+++ ipcop/trunk/src/installer/installer.c 2009-04-12 08:10:16 UTC (rev
2699)
@@ -57,13 +57,14 @@
struct utsname utsbuf;
/* local variables */
-static NODEKV *kv = NULL; /* contains a list
key=value pairs from boot parameters */
+static int codepath = 0; /* for better test, allow testing
dhcp and manual path even on pxe boot */
+static NODEKV *kv = NULL; /* contains a list key=value pairs
from boot parameters */
static char command[STRING_SIZE];
static char message[STRING_SIZE_LARGE];
static int scsi_cdrom;
static char local_IP[STRING_SIZE] = "";
-static char server_IP[STRING_SIZE] = ""; /* http/ftp server to
install from network */
-static char itf_name[STRING_SIZE] = ""; /* interface to install */
+static char server_IP[STRING_SIZE] = ""; /* http/ftp server to install from
network */
+static char itf_name[STRING_SIZE] = ""; /* interface to install */
static char netboot_dhcp_IP[STRING_SIZE] = "";
static char netmask[STRING_SIZE] = "";
static char netboot_mac[STRING_SIZE] = "";
@@ -245,6 +246,24 @@
}
+/* To ease testing, allow to force dhcp(1) or manual(2) path even on pxe boot
+ Just type 'install codepath=(1|2)' */
+static void read_codepath(void)
+{
+ char string[STRING_SIZE];
+ char strboot[STRING_SIZE] = "none";
+ find_kv_default(kv, "ipcopboot", strboot);
+
+ if (find_kv_default(kv, "codepath", string) == SUCCESS) {
+ if (!strcmp(string, "1") || !strcmp(string, "2")) {
+ codepath = atoi(string);
+ } else {
+ fprintf(flog, "Bad codepath value\n");
+ }
+ }
+}
+
+
/*
ISO from http/ftp server
TODO offer a manual / automatic configuration selection
@@ -291,7 +310,7 @@
newtPopWindow();
/* if local IP has not been found by pxe, try to find by dhcp */
- if (strlen(local_IP) == 0) {
+ if (strlen(local_IP) == 0 || codepath == 1) {
newtComponent *f;
newtComponent scale;
f = (newtComponent *) statuswindow_progress(72, 5,
ipcop_gettext("TR_TITLE_SOURCE"),
@@ -314,7 +333,8 @@
}
newtPopWindow();
}
- if (strlen(local_IP) == 0) {
+ /* manual selection */
+ if (strlen(local_IP) == 0 || codepath == 2) {
/* if local IP still not configured, first select wich interface to
use */
if (select_interface()) {
fprintf(flog, "failure for manual interface selection\n");
@@ -742,7 +762,8 @@
fgets(line, STRING_SIZE, handle);
fclose(handle);
read_kv_from_line(&kv, line);
-
+ /* Want our tester have a better coverage of the code path */
+ read_codepath(); /* actually only force dhcp or manual path on pxe
boot */
/* On x86 netboot, read own IP, tftp server IP, dhcp server IP,
netmask and boot MAC */
read_netboot_values();
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Ipcop-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ipcop-svn