merged pda stuff
This commit is contained in:
commit
eac301aa16
13 changed files with 112 additions and 9 deletions
1
42sh/TESTSHELL/simple_cmd/echo.test
Normal file
1
42sh/TESTSHELL/simple_cmd/echo.test
Normal file
|
|
@ -0,0 +1 @@
|
|||
echo 'je suis un test'
|
||||
1
42sh/TESTSHELL/simple_cmd/ls.test
Normal file
1
42sh/TESTSHELL/simple_cmd/ls.test
Normal file
|
|
@ -0,0 +1 @@
|
|||
ls
|
||||
1
42sh/TESTSHELL/simple_cmd/pwd.test
Normal file
1
42sh/TESTSHELL/simple_cmd/pwd.test
Normal file
|
|
@ -0,0 +1 @@
|
|||
pwd
|
||||
0
42sh/TESTSHELL/stderr_ref
Normal file
0
42sh/TESTSHELL/stderr_ref
Normal file
0
42sh/TESTSHELL/stderr_test
Normal file
0
42sh/TESTSHELL/stderr_test
Normal file
14
42sh/TESTSHELL/stdin_ref
Normal file
14
42sh/TESTSHELL/stdin_ref
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
42sh
|
||||
Makefile
|
||||
TESTSHELL
|
||||
donovan_segaults_06-02
|
||||
file1
|
||||
file2
|
||||
includes
|
||||
libft
|
||||
objs
|
||||
pdf
|
||||
sample
|
||||
src
|
||||
test_framework.sh
|
||||
update_makefile.sh
|
||||
43
42sh/TESTSHELL/stdin_test
Normal file
43
42sh/TESTSHELL/stdin_test
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
[7m[33m main.c [1m[34m107[0m[7m[1m[32mstart of shell[0m JOBC is ON[0m
|
||||
[7m[33m token_print.c [1m[34m21 [0mtoken print[0m
|
||||
[7m[33m token_print.c [1m[34m25 [0mtoken : TK_WORD data [ls]
|
||||
[0m
|
||||
[7m[33m insert_newline.c [1m[34m19 [0minsert newline[0m
|
||||
[7m[33m ft_parse.c [1m[34m45 [0m
|
||||
[0m
|
||||
[7m[33m build_tree.c [1m[34m83 [0mfunc TK : 'TK_WORD' TK : 'TK_WORD'[0m
|
||||
[7m[33m add_cmd.c [1m[34m55 [0madd data[0m
|
||||
[7m[33m ft_parse.c [1m[34m45 [0m
|
||||
[0m
|
||||
[7m[33m build_tree.c [1m[34m83 [0mfunc TK : 'TK_NEWLINE' TK : 'TK_NEWLINE'[0m
|
||||
[7m[33m add_sep.c [1m[34m21 [0madd sep[0m
|
||||
[7m[33m ft_parse.c [1m[34m45 [0m
|
||||
[0m
|
||||
[7m[33m ft_parse.c [1m[34m58 [0msucessful parsing[0m
|
||||
[7m[33m main.c [1m[34m64 [0mBefore execution:[0m
|
||||
NEW
|
||||
+----+
|
||||
CMD
|
||||
[7m[33m ft_exec.c [1m[34m39 [0m[0m
|
||||
[7m[33m ft_exec.c [1m[34m48 [0mmatch : TK_NEWLINE and TK_NEWLINE[0m
|
||||
[7m[33m exec_semi.c [1m[34m20 [0m[0m
|
||||
[7m[33m exec_semi.c [1m[34m22 [0m[0m
|
||||
[7m[33m ft_exec.c [1m[34m39 [0m[0m
|
||||
[7m[33m ft_exec.c [1m[34m48 [0mmatch : NON-DEFINED and NON-DEFINED[0m
|
||||
[7m[33m exec_command.c [1m[34m52 [0mop=2118139328[0m
|
||||
42sh
|
||||
Makefile
|
||||
TESTSHELL
|
||||
donovan_segaults_06-02
|
||||
file1
|
||||
file2
|
||||
includes
|
||||
libft
|
||||
objs
|
||||
pdf
|
||||
sample
|
||||
src
|
||||
test_framework.sh
|
||||
update_makefile.sh
|
||||
[7m[33m exec_semi.c [1m[34m24 [0m[0m
|
||||
[7m[33m ft_exec.c [1m[34m39 [0m[0m
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/14 17:28:14 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/03 18:49:57 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/03 18:50:48 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/02 20:44:21 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/03 18:49:39 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/03 18:51:22 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/13 14:58:36 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/03 18:38:14 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/03 18:52:03 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -19,16 +19,13 @@ int put_job_in_foreground(t_job *j, int cont)
|
|||
jobc = &data_singleton()->jobc;
|
||||
tcsetpgrp(STDIN, j->pgid);
|
||||
tcsetattr(STDIN, TCSADRAIN, &jobc->shell_tmodes);
|
||||
|
||||
if (cont)
|
||||
{
|
||||
tcsetattr(STDIN, TCSADRAIN, &j->tmodes);
|
||||
if (kill(-j->pgid, SIGCONT) < 0)
|
||||
DG("kill(SIGCONT) failed");
|
||||
}
|
||||
DG("before wait");
|
||||
job_wait(j->id);
|
||||
DG("after wait");
|
||||
job_remove(j->id);
|
||||
|
||||
tcsetpgrp(STDIN, jobc->shell_pgid);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/15 14:19:48 by gwojda #+# #+# */
|
||||
/* Updated: 2017/03/02 12:36:35 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/03 18:29:03 by wescande ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/03 18:05:41 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/03 18:33:40 by wescande ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -63,10 +63,14 @@ int handle_instruction(int fd)
|
|||
}
|
||||
DG("Before execution:");
|
||||
btree_print(STDBUG, ast, &ft_putast);
|
||||
DG();
|
||||
if (ft_exec(&ast))
|
||||
return (1);
|
||||
DG();
|
||||
btree_del(&ast, &ast_free);
|
||||
DG();
|
||||
ft_add_str_in_history(lexer.str);
|
||||
DG();
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
@ -83,6 +87,7 @@ int get_input_fd()
|
|||
return (fd);
|
||||
else if (data->opts & SH_OPTS_LC)
|
||||
{
|
||||
DG();
|
||||
pipe(fds);
|
||||
fd = fds[PIPE_READ];
|
||||
file = shell_get_avdata();
|
||||
|
|
@ -105,7 +110,7 @@ int main(int ac, char **av)
|
|||
shell_init(ac, av);
|
||||
DG("{inv}{bol}{gre}start of shell{eoc} JOBC is %s",
|
||||
SH_HAS_JOBC(data_singleton()->opts)?"ON":"OFF");
|
||||
if ((fd = get_input_fd() < 0))
|
||||
if ((fd = get_input_fd()) < 0)
|
||||
{
|
||||
ft_printf("{red}%s: No such file or directory\n{eoc}", SHELL_NAME);
|
||||
return (1);
|
||||
|
|
|
|||
41
42sh/test_framework.sh
Executable file
41
42sh/test_framework.sh
Executable file
|
|
@ -0,0 +1,41 @@
|
|||
SHELL=$1
|
||||
TOTAL_TEST=0
|
||||
NBR_TEST_SUCCESS=0
|
||||
unset LIST_TEST
|
||||
LIST_TEST='./TESTSHELL/*'/'*'.test
|
||||
DIR_TEST=./TESTSHELL
|
||||
|
||||
do_test() {
|
||||
|
||||
for TEST in $LIST_TEST
|
||||
do
|
||||
|
||||
($SHELL < $TEST 1> ${DIR_TEST}/stdin_test 2> ${DIR_TEST}/stderr_test)
|
||||
(bash < $TEST 1> ${DIR_TEST}/stdin_ref 2> ${DIR_TEST}/stderr_ref)
|
||||
|
||||
if ! diff ${DIR_TEST}/stdin_test ${DIR_TEST}/stdin_ref > /dev/null ||
|
||||
! diff ${DIR_TEST}/stderr_test ${DIR_TEST}/stderr_test > /dev/null
|
||||
then
|
||||
echo "\033[0;31mFAILURE $TEST" >> ${DIR_TEST}/resultat
|
||||
else
|
||||
((NBR_TEST_SUCCESS++))
|
||||
fi
|
||||
((TOTAL_TEST++))
|
||||
done
|
||||
}
|
||||
|
||||
do_test
|
||||
|
||||
if [ -e ${DIR_TEST}/resultat ]
|
||||
then
|
||||
cat ${DIR_TEST}/resultat
|
||||
fi
|
||||
echo "\033[0;32mYou succeed $NBR_TEST_SUCCESS tests on $TOTAL_TEST"
|
||||
|
||||
rm -f $DIR_TEST/resultat
|
||||
|
||||
#add random input sed -n $RANDOM "p" /usr/share/dict/words
|
||||
#add timeout
|
||||
#charging phase of test
|
||||
#real verification of references
|
||||
#to add extranous comportement
|
||||
Loading…
Reference in a new issue