Blame tests/p_gcc/test_gcc.sh
|
Christoph Galuschka |
94e689 |
#!/bin/sh
|
|
Christoph Galuschka |
94e689 |
# Author: Christoph Galuschka <christoph.galuschka@chello.at>
|
|
Christoph Galuschka |
94e689 |
# Athmane Madjodj <athmanem@gmail.com>
|
|
Christoph Galuschka |
94e689 |
|
|
Karanbir Singh |
106bcf |
t_Log "Running $0 - gcc can build a hello world .c"
|
|
Christoph Galuschka |
94e689 |
|
|
Christoph Galuschka |
94e689 |
# creating source code
|
|
Christoph Galuschka |
94e689 |
FILE='/var/tmp/gcc-test.c'
|
|
Christoph Galuschka |
94e689 |
EXE='/var/tmp/gcc'
|
|
Christoph Galuschka |
94e689 |
|
|
Christoph Galuschka |
94e689 |
cat > $FILE <
|
|
Christoph Galuschka |
94e689 |
#include <stdio.h>
|
|
Christoph Galuschka |
94e689 |
main()
|
|
Christoph Galuschka |
94e689 |
{
|
|
Christoph Galuschka |
94e689 |
printf("hello, centos\n");
|
|
Christoph Galuschka |
94e689 |
}
|
|
Christoph Galuschka |
94e689 |
EOF
|
|
Christoph Galuschka |
94e689 |
|
|
Christoph Galuschka |
94e689 |
# Executing gcc
|
|
Christoph Galuschka |
94e689 |
gcc $FILE -o $EXE
|
|
Christoph Galuschka |
94e689 |
|
|
Christoph Galuschka |
94e689 |
# run EXE
|
|
Christoph Galuschka |
94e689 |
WORKING=$( $EXE |grep -c 'hello, centos')
|
|
Christoph Galuschka |
94e689 |
|
|
Christoph Galuschka |
94e689 |
if [ $WORKING -eq 1 ]
|
|
Christoph Galuschka |
94e689 |
then
|
|
Christoph Galuschka |
94e689 |
ret_val=0
|
|
Christoph Galuschka |
94e689 |
else
|
|
Christoph Galuschka |
94e689 |
ret_val=1
|
|
Christoph Galuschka |
94e689 |
fi
|
|
Christoph Galuschka |
94e689 |
|
|
Christoph Galuschka |
94e689 |
# remove files
|
|
Christoph Galuschka |
94e689 |
/bin/rm $FILE
|
|
Christoph Galuschka |
94e689 |
/bin/rm $EXE
|
|
Christoph Galuschka |
94e689 |
|
|
Christoph Galuschka |
94e689 |
t_CheckExitStatus $ret_val
|
|
Christoph Galuschka |
94e689 |
|