glib/tests/at-exit.c
changeset 50 79045913e4e9
child 72 403e7f6ed6c5
equal deleted inserted replaced
49:e5d77a29bdca 50:79045913e4e9
       
     1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #undef G_DISABLE_ASSERT
       
    17 #undef G_LOG_DOMAIN
       
    18 
       
    19 #include <glib.h>
       
    20 #include <errno.h>
       
    21 #define LOG_FILE "c:\\logs\\at_exit_log.txt"
       
    22 #include "std_log_result.h"
       
    23 #define LOG_FILENAME_LINE __FILE__, __LINE__
       
    24 
       
    25 void create_xml(int result)
       
    26 {
       
    27     if(result)
       
    28         assert_failed = 1;
       
    29     
       
    30     testResultXml("at_exit_log");
       
    31     close_log_file();
       
    32 }
       
    33 
       
    34 void on_exit()
       
    35     {
       
    36     std_log(LOG_FILENAME_LINE,"Test Successful");
       
    37     create_xml(0);    
       
    38     }
       
    39 
       
    40 int main (int argc, char *argv[])
       
    41 {
       
    42     g_atexit(on_exit);
       
    43     std_log(LOG_FILENAME_LINE, "Test ll be considered failed if on_exit() is not called");
       
    44     return 0;
       
    45 }