[llvm-commits] [PATCH] Program to aid in automated testing on windows.

Michael Spencer bigcheesegs at gmail.com
Tue Sep 21 13:18:18 PDT 2010


On Tue, Sep 21, 2010 at 3:37 PM, Óscar Fuentes <ofv at wanadoo.es> wrote:
> The following message is a courtesy copy of an article
> that has been posted to gmane.comp.compilers.llvm.cvs as well.
>
> Michael Spencer <bigcheesegs-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org>
> writes:
>
>> While porting test-suite over to lit so I could run it on Windows I
>> ran into severe issues due to Dr. Watson and the C runtime.
>
> [snip]
>
> For solving the same problem on my compiler I use something like the
> chunk of code below. It works fine on Windows XP, although in one case
> it still pops the dialog on Vista/7. I didn't investigate the issue but
> it is probably a missing _CrtSetReportMode call. Maybe it is worth a try
> before adding yet another utility.
>
> #include <signal.h>
> #include <stdio.h>
> #include <stdlib.h>
>
> #if defined(_MSC_VER) && ! defined(NDEBUG)
> # include <crtdbg.h>
> #endif
>
> #if defined(_WIN32)
> # include <windows.h>
> #endif
>
> void InstallSignalHandlers();
>
> #define SIGNAL_ARGS int sig
>
> void sig_abrt_catcher(SIGNAL_ARGS);
> void sig_ill_catcher(SIGNAL_ARGS);
> void sig_fpr_catcher(SIGNAL_ARGS);
> void sig_segv_catcher(SIGNAL_ARGS);
>
> int main() {
>  /* ... */
>  InstallSignalHandlers();
>  /* ... */
> }
>
> void InstallSignalHandlers() {
>  signal(SIGFPE, &sig_abrt_catcher);
>  signal(SIGFPE, &sig_ill_catcher);
>  signal(SIGFPE, &sig_fpr_catcher);
>  signal(SIGSEGV, &sig_segv_catcher);
> #if defined(_MSC_VER) && ! defined(NDEBUG)
>  _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
>  _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
>  _CrtSetReportHook(&MsvcrtReportHook);
>  _set_error_mode(_OUT_TO_STDERR);
> #endif // #if defined(_MSC_VER) && ! defined(NDEBUG)
> #if defined(_WIN32)
>  SetUnhandledExceptionFilter(&UnhandledWin32Exception);
> #endif
> }
>
> void sig_abrt_catcher(SIGNAL_ARGS) {
>  puts("SIGABRT\n");
>  exit(3);
> }
>
> void sig_ill_catcher(SIGNAL_ARGS) {
>  puts("SIGILL\n");
>  exit(3);
> }
>
> void sig_fpr_catcher(SIGNAL_ARGS) {
>  puts("SIGFPR\n");
>  exit(3);
> }
>
> void sig_segv_catcher(SIGNAL_ARGS) {
>  puts("SIGSEGV\n");
>  exit(3);
> }
>

The problem with the above is that it only affects the program that
has the code in it. Unless it is acceptable to add this to every
single test in the test suite, then that wont work. It is also useless
for programs that we are not compiling.

- Michael Spencer




More information about the llvm-commits mailing list