David Summers <david@summersoft.fay.ar.us> writes:
> Assuming we still need the slow version in production code, could
> there be a test-suite option to use the fast one? I it currently
> taking my RPM test suite builds 4+? hours to complete the 3x2 tests
> they are currently doing. I was thinking of just configuring/building
> with the fast version, do the tests, and then rebuilding with the
> slow version but if there were test suite options to to this then that
> would be much better.
You could use an LD_PRELOAD library to intercept the open calls and
change /dev/random into /dev/urandom, this can also be used if you
want to use installed APR that is configured to use /dev/random.
Something like:
/*
Compile like so:
gcc -rdynamic -fPIC -O2 -Wall -shared -o libxxxx.so xxxx.c -ldl
Use like so:
(export LD_PRELOAD=$PWD/libxxxx.so; make svnserveautocheck)
*/
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
#include <string.h>
int open(const char *pathname, int flags, mode_t mode)
{
static int (*libc_open)(const char *, int, mode_t) = NULL;
if (!libc_open) {
void *handle = dlopen("libc.so.6", RTLD_LAZY);
if (!handle) {
fprintf(stderr, "%s\n", dlerror());
exit(1);
}
dlerror();
libc_open = dlsym(handle, "open");
char *error = dlerror();
if (error || !libc_open) {
fprintf(stderr, "%s\n", error ? error : "null!!");
exit(1);
}
}
if (!strcmp(pathname, "/dev/random"))
pathname = "/dev/urandom";
return libc_open(pathname, flags, mode);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Nov 3 00:56:01 2007