xicodomingues / francinette

An easy to use testing framework for the 42 projects
MIT License
438 stars 45 forks source link

minitalk tests not working #29

Open UncleJ4ck opened 1 year ago

UncleJ4ck commented 1 year ago

Bug:

when i start the francinette in my root projecs, it keeps working normally until it starts the tests and it displays an error about leaks "Leaks: ⠙'NoneType' object has no attribute 'group'" , i guess it's some kinda of a bug

LOG File:


2022-11-20 18:17:04,521 [c selector][INFO]: Testing path: /home/jack/Desktop/test/42repos/cursus/minitalk/ex00
2022-11-20 18:17:04,522 [utils][INFO]: Makefile path: /home/jack/Desktop/test/42repos/cursus/minitalk/Makefile
2022-11-20 18:17:04,522 [gnl][INFO]: Testing: get_next_line.c
2022-11-20 18:17:04,522 [utils][INFO]: Makefile path: /home/jack/Desktop/test/42repos/cursus/minitalk/Makefile
2022-11-20 18:17:04,523 [minitalk][INFO]: Makefile path: /home/jack/Desktop/test/42repos/cursus/minitalk/Makefile
2022-11-20 18:17:04,523 [minitalk][INFO]: Makefile path: /home/jack/Desktop/test/42repos/cursus/minitalk/Makefile
2022-11-20 18:17:04,523 [main][INFO]: Test params: TestRunInfo(source_dir=PosixPath('/home/jack/Desktop/test/42repos/cursus/minitalk'), base_dir=PosixPath('/home/jack/francinette'), ex_to_execute=None, args=Namespace(bonus=False, clean=False, exercise=[], git_repo=None, ignore_norm=False, mandatory=False, strict=False, testers=None, timeout='10', update=False, verbose=False), has_bonus=False)
2022-11-20 18:17:04,532 [base][INFO]: Removing already present directory /home/jack/francinette/temp/minitalk
2022-11-20 18:17:04,532 [base][INFO]: copying /home/jack/Desktop/test/42repos/cursus/minitalk to /home/jack/francinette/temp/minitalk
2022-11-20 18:17:04,535 [base][ERROR]: 
Traceback (most recent call last):
  File "/home/jack/francinette/testers/BaseTester.py", line 120, in prepare_ex_files
    repo = git.Repo(self.temp_dir)
  File "/home/jack/francinette/venv/lib/python3.8/site-packages/git/repo/base.py", line 266, in __init__
    self.working_dir: Optional[PathLike] = self._working_tree_dir or self.common_dir
  File "/home/jack/francinette/venv/lib/python3.8/site-packages/git/repo/base.py", line 347, in common_dir
    raise InvalidGitRepositoryError()
git.exc.InvalidGitRepositoryError
2022-11-20 18:17:04,615 [base][INFO]: On directory /home/jack/francinette/temp/minitalk
2022-11-20 18:17:04,825 [base][INFO]: CompletedProcess(args=['norminette'], returncode=0, stdout='minitalk.h: OK!\nclient.c: OK!\nserver.c: OK!\n', stderr='')
2022-11-20 18:17:04,862 [base][INFO]: copying /home/jack/Desktop/test/42repos/cursus/minitalk to /home/jack/francinette/temp/minitalk/__my_srcs
2022-11-20 18:17:04,863 [base][INFO]: bonus investigation: []
2022-11-20 18:17:04,863 [base][INFO]: To execute: []
2022-11-20 18:17:04,863 [base][INFO]: Missing: []
2022-11-20 18:17:04,863 [base][INFO]: Calling 'make fclean all' on directory /home/jack/francinette/temp/minitalk
2022-11-20 18:17:04,979 [base][INFO]: CompletedProcess(args=['make', 'fclean', 'all'], returncode=0, stdout='rm -f server client\ncc -Wall -Wextra -Werror server.c -o server\ncc -Wall -Wextra -Werror client.c -o client\n', stderr='')
2022-11-20 18:17:05,025 [base][INFO]: Copying from /home/jack/francinette/tests/minitalk/fsoares to /home/jack/francinette/temp/minitalk/fsoares
2022-11-20 18:17:05,026 [base_exec][INFO]: on dir /home/jack/francinette/temp/minitalk/fsoares
2022-11-20 18:17:05,032 [base_exec][INFO]: added sanitization to makefile ../__my_srcs/Makefile
2022-11-20 18:17:05,032 [base_exec][INFO]: executing: make TIMEOUT=10  fclean all
2022-11-20 18:17:05,032 [base_exec][INFO]: on dir /home/jack/francinette/temp/minitalk/fsoares
2022-11-20 18:17:05,306 [base_exec][INFO]: 
2022-11-20 18:17:05,500 [mt-fsoares][INFO]: CompletedProcess(args="/home/jack/francinette/temp/minitalk/__my_srcs/client 1997 'teste\n-----\n'", returncode=0, stdout=b'', stderr=b'')
2022-11-20 18:17:05,517 [mt-fsoares][INFO]: CompletedProcess(args=['kill', '-INT', '1997'], returncode=0, stdout=b'', stderr=b'')
2022-11-20 18:17:05,519 [base][ERROR]: 'NoneType' object has no attribute 'group'
Traceback (most recent call last):
  File "/home/jack/francinette/testers/BaseTester.py", line 183, in test_using
    return (tester.name, tx.execute())
  File "/home/jack/francinette/testers/minitalk/Fsoares.py", line 76, in execute
    result = self.test_client_server()
  File "/home/jack/francinette/testers/minitalk/Fsoares.py", line 89, in test_client_server
    no_leaks = self.test_leaks()
  File "/home/jack/francinette/testers/minitalk/Fsoares.py", line 234, in test_leaks
    self.send_message(server, "teste\n-----\n")
  File "/home/jack/francinette/testers/minitalk/Fsoares.py", line 266, in send_message
    return re.match(r"__PID: (\d+)", client.stdout.decode('utf-8', errors="backslashreplace")).group(1)
AttributeError: 'NoneType' object has no attribute 'group'
2022-11-20 18:17:05,523 [base][WARNING]: norminette errors: []
2022-11-20 18:17:05,523 [base][WARNING]: missing functions: []
2022-11-20 18:17:05,523 [base][WARNING]: errors in functions: [('fsoares', ['fsoares'])]```
Kuninoto commented 1 year ago

Yep. I'm having the same bug!

xicodomingues commented 1 year ago

Yeah, it looks like a bug of some kind. What I do is add some code to your source files, but for some reason it looks like it is not adding it. Could you send me the source code so I can see if I can figure out what is the problem?

Kuninoto commented 1 year ago

@xicodomingues Yes! It is fully available on my repository: https://github.com/Kuninoto/42_minitalk

xicodomingues commented 1 year ago

This specific error does not happen to me. Maybe it is related to operating system. I'm on MacOS Catalina. I can try and test it on linux.

What occurs to me is that grep may work differently on Linux compared to mac. (I depend on it to know which files have a main)

@Kuninoto In your case, that error does not happen on my pc, but what happens is that because you do not terminate the client after sending a message then the test times out, because the tester depends on that behavior.

fhassoun commented 1 year ago

i have the same problem, it gives me : ✔ Executing: make fclean bonus ℹ Running tests: fsoares (my own tests) Leaks: ⠙'NoneType' object has no attribute 'group'

im on ubuntu 20.04


2023-01-03 08:07:47,740 [main][INFO]: current_dir: minitalk_git
2023-01-03 08:07:47,740 [c selector][INFO]: Testing path: /nfs/homes/fhassoun/dev_area/core/my_github/minitalk_git/ex00
2023-01-03 08:07:47,740 [utils][INFO]: Makefile path: /nfs/homes/fhassoun/dev_area/core/my_github/minitalk_git/Makefile
2023-01-03 08:07:47,741 [gnl][INFO]: Testing: get_next_line.c
2023-01-03 08:07:47,741 [utils][INFO]: Makefile path: /nfs/homes/fhassoun/dev_area/core/my_github/minitalk_git/Makefile
2023-01-03 08:07:47,742 [minitalk][INFO]: Makefile path: /nfs/homes/fhassoun/dev_area/core/my_github/minitalk_git/Makefile
2023-01-03 08:07:47,742 [minitalk][INFO]: Makefile path: /nfs/homes/fhassoun/dev_area/core/my_github/minitalk_git/Makefile
2023-01-03 08:07:47,743 [main][INFO]: Test params: TestRunInfo(source_dir=PosixPath('/nfs/homes/fhassoun/dev_area/core/my_github/minitalk_git'), base_dir=PosixPath('/nfs/homes/fhassoun/francinette'), ex_to_execute=None, args=Namespace(bonus=False, clean=False, exercise=[], git_repo=None, ignore_norm=False, mandatory=False, strict=False, testers=None, timeout=None, update=False, verbose=False), has_bonus=False)
2023-01-03 08:07:47,747 [base][INFO]: Removing already present directory /nfs/homes/fhassoun/francinette/temp/minitalk
2023-01-03 08:07:47,871 [base][INFO]: copying /nfs/homes/fhassoun/dev_area/core/my_github/minitalk_git to /nfs/homes/fhassoun/francinette/temp/minitalk
2023-01-03 08:07:48,341 [base][INFO]: removing ignored file: /nfs/homes/fhassoun/francinette/temp/minitalk/a.out
2023-01-03 08:07:48,370 [base][INFO]: removing ignored file: /nfs/homes/fhassoun/francinette/temp/minitalk/libft.a
2023-01-03 08:07:48,841 [base][INFO]: removing /nfs/homes/fhassoun/francinette/temp/minitalk/.git
2023-01-03 08:07:48,951 [base][INFO]: On directory /nfs/homes/fhassoun/francinette/temp/minitalk
2023-01-03 08:07:49,485 [base][INFO]: CompletedProcess(args=['norminette'], returncode=1, stdout='server.c: Error!\nError: SPACE_BEFORE_FUNC    (line:  17, col:  12):\tspace before function name\nError: TOO_FEW_TAB          (line:  21, col:   1):\tMissing tabs for indent level\nError: SPACE_REPLACE_TAB    (line:  21, col:   5):\tFound space when expecting tab\nError: SPACE_REPLACE_TAB    (line:  26, col:  21):\tFound space when expecting tab\nError: SPACE_REPLACE_TAB    (line:  27, col:   8):\tFound space when expecting tab\nError: MISALIGNED_VAR_DECL  (line:  27, col:   9):\tMisaligned variable declaration\nError: EMPTY_LINE_FUNCTION  (line:  31, col:   1):\tEmpty line in function\nError: CONSECUTIVE_NEWLINES (line:  32, col:   1):\tConsecutive newlines\nError: EMPTY_LINE_FUNCTION  (line:  32, col:   1):\tEmpty line in function\nError: SPACE_EMPTY_LINE     (line:  32, col:   1):\tSpace on empty line\nError: SPACE_REPLACE_TAB    (line:  34, col:   5):\tFound space when expecting tab\nError: CONSECUTIVE_SPC      (line:  34, col:  17):\tTwo or more consecutives spaces\nError: TOO_FEW_TAB          (line:  35, col:   1):\tMissing tabs for indent level\nError: SPACE_REPLACE_TAB    (line:  35, col:   5):\tFound space when expecting tab\nError: TOO_FEW_TAB          (line:  36, col:   1):\tMissing tabs for indent level\nError: SPACE_REPLACE_TAB    (line:  36, col:   5):\tFound space when expecting tab\nError: BRACE_SHOULD_EOL     (line:  40, col:   1):\tExpected newline after brace\nminitalk.h: Error!\nError: CONSECUTIVE_NEWLINES (line:  21, col:   1):\tConsecutive newlines\nError: CONSECUTIVE_NEWLINES (line:  22, col:   1):\tConsecutive newlines\nclient.c: Error!\nError: SPACE_BEFORE_FUNC    (line:  26, col:  12):\tspace before function name\nError: TOO_FEW_TAB          (line:  30, col:   1):\tMissing tabs for indent level\nError: SPACE_REPLACE_TAB    (line:  30, col:   5):\tFound space when expecting tab\nError: SPC_BEFORE_NL        (line:  30, col:  18):\tSpace before newline\nError: SPACE_REPLACE_TAB    (line:  35, col:  21):\tFound space when expecting tab\nError: SPACE_REPLACE_TAB    (line:  36, col:   8):\tFound space when expecting tab\nError: MISALIGNED_VAR_DECL  (line:  36, col:   9):\tMisaligned variable declaration\nError: SPACE_REPLACE_TAB    (line:  37, col:   9):\tFound space when expecting tab\nError: MISALIGNED_VAR_DECL  (line:  37, col:  10):\tMisaligned variable declaration\nError: SPACE_REPLACE_TAB    (line:  38, col:  17):\tFound space when expecting tab\nError: MISALIGNED_VAR_DECL  (line:  38, col:  18):\tMisaligned variable declaration\nError: NO_SPC_BFR_PAR       (line:  40, col:  19):\tExtra space before parenthesis (brace/bracket)\nError: SPACE_AFTER_KW       (line:  43, col:   9):\tMissing space after keyword\nError: SPC_BFR_PAR          (line:  43, col:  15):\tMissing space before parenthesis (brace/bracket)\nError: BRACE_SHOULD_EOL     (line:  58, col:   1):\tExpected newline after brace\nlibft/ft_printf_utils.c: OK!\nlibft/ft_strmapi.c: OK!\nlibft/libft.h: OK!\nlibft/ft_lstadd_back.c: OK!\nlibft/ft_printf_convert.c: OK!\nlibft/ft_itoa.c: OK!\nlibft/ft_lstdelone.c: OK!\nlibft/ft_putstr_fd.c: OK!\nlibft/ft_strlcpy.c: OK!\nlibft/ft_tolower.c: OK!\nlibft/ft_printf.h: OK!\nlibft/ft_atoi.c: OK!\nlibft/ft_striteri.c: OK!\nlibft/ft_putchar_fd.c: OK!\nlibft/ft_toupper.c: OK!\nlibft/ft_memchr.c: OK!\nlibft/ft_isdigit.c: OK!\nlibft/ft_putnbr_fd.c: OK!\nlibft/ft_substr.c: OK!\nlibft/ft_lstadd_front.c: OK!\nlibft/ft_lstnew.c: OK!\nlibft/ft_lstiter.c: OK!\nlibft/ft_strrchr.c: OK!\nlibft/ft_lstsize.c: OK!\nlibft/ft_strncmp.c: OK!\nlibft/ft_gnl.h: OK!\nlibft/ft_lstlast.c: OK!\nlibft/ft_gnl_utils.c: OK!\nlibft/ft_strlen.c: OK!\nlibft/ft_gnl.c: OK!\nlibft/ft_memcmp.c: OK!\nlibft/ft_strnstr.c: OK!\nlibft/ft_isalpha.c: OK!\nlibft/ft_memset.c: OK!\nlibft/ft_isalnum.c: OK!\nlibft/ft_strdup.c: OK!\nlibft/ft_lstclear.c: OK!\nlibft/ft_strlcat.c: OK!\nlibft/ft_memmove.c: OK!\nlibft/ft_strjoin.c: OK!\nlibft/ft_lstmap.c: OK!\nlibft/ft_isascii.c: OK!\nlibft/ft_putendl_fd.c: OK!\nlibft/ft_isprint.c: OK!\nlibft/ft_printf.c: OK!\nlibft/ft_memcpy.c: OK!\nlibft/ft_calloc.c: OK!\nlibft/ft_split.c: OK!\nlibft/ft_strtrim.c: OK!\nlibft/ft_strchr.c: OK!\nlibft/ft_bzero.c: OK!\n', stderr='')
2023-01-03 08:07:49,515 [base][INFO]: copying /nfs/homes/fhassoun/dev_area/core/my_github/minitalk_git to /nfs/homes/fhassoun/francinette/temp/minitalk/__my_srcs
2023-01-03 08:07:49,941 [base][INFO]: bonus investigation: ['bonus: server client\n']
2023-01-03 08:07:49,942 [base][INFO]: To execute: []
2023-01-03 08:07:49,942 [base][INFO]: Missing: []
2023-01-03 08:07:49,942 [base][INFO]: Calling 'make fclean bonus' on directory /nfs/homes/fhassoun/francinette/temp/minitalk
2023-01-03 08:07:50,043 [base][INFO]: CompletedProcess(args=['make', 'fclean', 'bonus'], returncode=0, stdout='rm -f server client libft.a\ncc -Wall -Wextra -Werror    server.c   -o server\ncc -Wall -Wextra -Werror    client.c   -o client\n', stderr='')
2023-01-03 08:07:50,105 [base][INFO]: Copying from /nfs/homes/fhassoun/francinette/tests/minitalk/fsoares to /nfs/homes/fhassoun/francinette/temp/minitalk/fsoares
2023-01-03 08:07:50,118 [base_exec][INFO]: on dir /nfs/homes/fhassoun/francinette/temp/minitalk/fsoares
2023-01-03 08:07:50,147 [base_exec][INFO]: added sanitization to makefile ../__my_srcs/Makefile
2023-01-03 08:07:50,149 [base_exec][INFO]: added sanitization to makefile ../__my_srcs/libft/Makefile
2023-01-03 08:07:50,150 [base_exec][INFO]: executing: make TIMEOUT=30  fclean all
2023-01-03 08:07:50,150 [base_exec][INFO]: on dir /nfs/homes/fhassoun/francinette/temp/minitalk/fsoares
2023-01-03 08:07:50,401 [base_exec][INFO]: 
2023-01-03 08:07:50,556 [mt-fsoares][INFO]: CompletedProcess(args="/nfs/homes/fhassoun/francinette/temp/minitalk/__my_srcs/client 294822 'teste\n-----\n'", returncode=0, stdout=b'', stderr=b'')
2023-01-03 08:07:50,565 [mt-fsoares][INFO]: CompletedProcess(args=['kill', '-INT', '294822'], returncode=0, stdout=b'', stderr=b'')
2023-01-03 08:07:50,566 [base][ERROR]: 'NoneType' object has no attribute 'group'
Traceback (most recent call last):
  File "/nfs/homes/fhassoun/francinette/testers/BaseTester.py", line 183, in test_using
    return (tester.name, tx.execute())
  File "/nfs/homes/fhassoun/francinette/testers/minitalk/Fsoares.py", line 77, in execute
    result = self.test_client_server()
  File "/nfs/homes/fhassoun/francinette/testers/minitalk/Fsoares.py", line 96, in test_client_server
    no_leaks = self.test_leaks()
  File "/nfs/homes/fhassoun/francinette/testers/minitalk/Fsoares.py", line 243, in test_leaks
    self.send_message(server, "teste\n-----\n")
  File "/nfs/homes/fhassoun/francinette/testers/minitalk/Fsoares.py", line 275, in send_message
    return re.match(r"__PID: (\d+)", client.stdout.decode('utf-8', errors="backslashreplace")).group(1)
AttributeError: 'NoneType' object has no attribute 'group'
2023-01-03 08:07:50,571 [base][WARNING]: norminette errors: ['server.c', 'minitalk.h', 'client.c']
2023-01-03 08:07:50,571 [base][WARNING]: missing functions: []
2023-01-03 08:07:50,572 [base][WARNING]: errors in functions: [('fsoares', ['fsoares'])]
552020 commented 11 months ago

Same here Ubuntu 22.04