Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 1473593 Details for
Bug 1372304
glibc: backport build/testing time improvements
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
test-skeleton-log.patch
test-skeleton-log.patch (text/plain), 3.07 KB, created by
Florian Weimer
on 2018-08-06 12:26:22 UTC
(
hide
)
Description:
test-skeleton-log.patch
Filename:
MIME Type:
Creator:
Florian Weimer
Created:
2018-08-06 12:26:22 UTC
Size:
3.07 KB
patch
obsolete
>commit a5fdb7057444232fead2d9016f530768adc96af1 >Author: Florian Weimer <fweimer@redhat.com> >Date: Mon Aug 29 12:14:53 2016 +0200 > > WIP: Log test wall clock > >diff --git a/test-skeleton.c b/test-skeleton.c >index 913a335782..8f4106c615 100644 >--- a/test-skeleton.c >+++ b/test-skeleton.c >@@ -33,6 +33,7 @@ > #include <sys/wait.h> > #include <sys/param.h> > #include <time.h> >+#include <sys/time.h> > > /* The test function is normally called `do_test' and it is called > with argc and argv as the arguments. We nevertheless provide the >@@ -115,6 +116,36 @@ xrealloc (void *p, size_t n) > return result; > } > >+/* Call asprintf and return the result. Implemented as a macro, to >+ avoid including <stdarg.h>. */ >+#define xasprintf(fmt, ...) \ >+ ({ \ >+ char *__xasprintf_result; \ >+ int __xasprintf_ret \ >+ = asprintf (&__xasprintf_result, (fmt), __VA_ARGS__); \ >+ if (__xasprintf_ret < 0) \ >+ { \ >+ printf ("error: asprintf: %m\n"); \ >+ exit (1); \ >+ } \ >+ __xasprintf_result; \ >+ }) >+ >+ >+/* Call gettimeofday with error checking and return the result. */ >+__attribute__ ((unused)) >+struct timeval >+xgettimeofday (void) >+{ >+ struct timeval tv; >+ if (gettimeofday (&tv, NULL) != 0) >+ { >+ printf ("error: gettimeofday: %m\n"); >+ _exit (1); >+ } >+ return tv; >+} >+ > /* Write a message to standard output. Can be used in signal > handlers. */ > static void >@@ -414,6 +445,8 @@ main (int argc, char *argv[]) > argv += optind - 1; > argc -= optind - 1; > >+ struct timeval tv_start = xgettimeofday (); >+ > /* Call the initializing function, if one is available. */ > #ifdef PREPARE > PREPARE (argc, argv); >@@ -516,6 +549,51 @@ main (int argc, char *argv[]) > exit (1); > } > >+ struct timeval tv_end = xgettimeofday (); >+ { >+ const char *log_file = getenv ("TEST_LOG_FILE"); >+ if (log_file != NULL) >+ { >+ struct timeval diff; >+ diff.tv_sec = tv_end.tv_sec - tv_start.tv_sec; >+ diff.tv_usec = tv_end.tv_usec - tv_start.tv_usec; >+ if (tv_end.tv_usec < tv_start.tv_usec) >+ { >+ --diff.tv_sec; >+ diff.tv_usec += 1000 * 1000; >+ } >+ /* Write the log message to the output file in a single >+ operation, to avoid interleaving. */ >+ char *log_message >+ = xasprintf ("%s %lld.%06d\n", >+ argv[0], (long long) diff.tv_sec, (int) diff.tv_usec); >+ size_t log_message_length = strlen (log_message); >+ int fd = open (log_file, O_CREAT | O_WRONLY | O_APPEND, 0666); >+ if (fd < 0) >+ { >+ printf ("error: open (\"%s\"): %m\n", log_file); >+ exit (1); >+ } >+ ssize_t ret = write (fd, log_message, log_message_length); >+ if (ret < 0) >+ { >+ printf ("error: log file write: %m\n"); >+ exit (1); >+ } >+ if (ret != (ssize_t) log_message_length) >+ { >+ printf ("error: unexpected result of log file write\n" >+ " expected=%zu, actual=%zd\n", log_message_length, ret); >+ exit (1); >+ } >+ if (close (fd) < 0) >+ { >+ printf ("error: log file close: %m\n"); >+ exit (1); >+ } >+ } >+ } >+ > /* Process terminated normaly without timeout etc. */ > if (WIFEXITED (status)) > {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1372304
: 1473593