46 lines
1.2 KiB
C
46 lines
1.2 KiB
C
|
/*
|
||
|
* This file is part of Jehanne.
|
||
|
*
|
||
|
* Copyright (C) 2017 Giacomo Tesio <giacomo@tesio.it>
|
||
|
*
|
||
|
* This is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, version 3 of the License.
|
||
|
*
|
||
|
* Jehanne is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with Jehanne. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*/
|
||
|
#include <u.h>
|
||
|
#include <libc.h>
|
||
|
#include <posix.h>
|
||
|
|
||
|
static char*
|
||
|
qa_exit_translator(int status)
|
||
|
{
|
||
|
if(jehanne_getpid() == jehanne_getmainpid()){
|
||
|
/* the QA test may fork, but only the main process
|
||
|
* should return PASS/FAIL
|
||
|
*/
|
||
|
if(status == 0){
|
||
|
jehanne_print("PASS\n");
|
||
|
return "PASS";
|
||
|
} else {
|
||
|
jehanne_print("FAIL: " __POSIX_EXIT_PREFIX "%d\n", status);
|
||
|
return "FAIL";
|
||
|
}
|
||
|
}
|
||
|
return nil;
|
||
|
}
|
||
|
|
||
|
void
|
||
|
__application_newlib_init(void)
|
||
|
{
|
||
|
libposix_translate_exit_status(qa_exit_translator);
|
||
|
libposix_emulate_SIGCHLD();
|
||
|
}
|