Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Make test #47

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions tests/p_bc/bc-test-basic-functionalities.sh

This file was deleted.

8 changes: 0 additions & 8 deletions tests/p_bc/bc-test-installation.sh

This file was deleted.

11 changes: 11 additions & 0 deletions tests/p_make/0-install_make.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
# Author: Lz <[email protected]>

if [ "$centos_ver" -ge "8" ];then
t_Log "Package not included in CentOS $centos_ver => SKIP"
exit 0
fi

t_Log "$0 - installing gcc make"
t_InstallPackage gcc make

48 changes: 48 additions & 0 deletions tests/p_make/10-test_make.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

# Author: Lz <[email protected]>

if [ "$centos_ver" -ge "8" ];then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as gcc and make are available, can you (if you still want to) rebase this PR to also cover 8 ?

t_Log "Package not included in CentOS $centos_ver => SKIP"
exit 0
fi

t_Log "Running $0 - Testing make by running it with a basic file"

# creating source code
T_PATH='/var/tmp/make-test'
FILE="${T_PATH}/make-gcc.c"
EXE="${T_PATH}/make-gcc"
MAKEFILE="${T_PATH}/Makefile"


if [ ! -d "${T_PATH}" ];then
mkdir -p ${T_PATH}
fi

cat > ${MAKEFILE} <<EOF
helloworld:
gcc -o ${EXE} ${FILE}
EOF

cat > ${FILE} <<EOF
#include<stdio.h>
int main()
{
printf("HelloWorld\n");
return 0;
}
EOF


# Executing make
cd ${T_PATH}
make
cd -

# run EXE
$EXE | grep -q 'HelloWorld'
t_CheckExitStatus $?

# remove files
/bin/rm ${T_PATH} -rf