Skip to contentSkip to conversation

kbuild

GIT Sam Ravnborg 1 participant 1 message Mar 18, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Fix the following issues:

o 'make randconfig' failed to generate random values for choices thus letting several build-time bugs slip through the randconfig based testing in tip - and likely for others doing builds based on randconfig too

This fix is not a minimal fix - some effort were put into making the code more strightforward and a few comments was added in the process.

o Use seed for random with a resolution higher than 1 second. Now that 'make randconfig' is much faster we can generate more than one randconfig on a decent box within one second.

Please pull,
Sam

The following changes since commit 5bee17f18b595937e6beafeee5197868a3f74a06:
Kyle McMartin (1):
parisc: sba_iommu: fix build bug when CONFIG_PARISC_AGP=y

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes.git master

Ingo Molnar (1):
kconfig: improve seed in randconfig

Sam Ravnborg (1):
kconfig: fix randconfig for choice blocks

Full diff of the two changes:

 scripts/kconfig/conf.c     |   16 +++++++++++++-
 scripts/kconfig/confdata.c |   51 +++++++++++++++++++++++++++++++-------------
 2 files changed, 51 insertions(+), 16 deletions(-)
scripts/kconfig/conf.c +15 -1
index 3e1057f..d190092 100644
@@ -11,6 +11,7 @@
 #include <time.h>
 #include <unistd.h>
 #include <sys/stat.h>
+#include <sys/time.h>
 
 #define LKC_DIRECT_LINK
 #include "lkc.h"
@@ -464,9 +465,22 @@ int main(int ac, char **av)
 			input_mode = set_yes;
 			break;
 		case 'r':
+		{
+			struct timeval now;
+			unsigned int seed;
+
+			/*
+			 * Use microseconds derived seed,
+			 * compensate for systems where it may be zero
+			 */
+			gettimeofday(&now, NULL);
+
+			seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1));
+			srand(seed);
+
 			input_mode = set_random;
-			srand(time(NULL));
 			break;
+		}
 		case 'h':
 			printf(_("See README for usage info\n"));
 			exit(0);
scripts/kconfig/confdata.c +36 -15

71 lines not on this page · raw message