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

External modes test and minor optimization #5480

Merged
merged 2 commits into from
May 18, 2024
Merged
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
3 changes: 3 additions & 0 deletions src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,9 @@ check: default
$(MAKE) unit-tests
../run/john --test=0 --verbosity=2 --format=cpu
../run/john --test=0 --verbosity=2 --format=+dynamic,all
if [ -x /usr/bin/md5sum ]; then \
JOHN=../run/john tests/test_externals.sh | md5sum -c tests/test_externals.md5; \
fi

depend:
makedepend -fMakefile.dep -Y *.c 2>> /dev/null
Expand Down
12 changes: 11 additions & 1 deletion src/compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,17 @@ static int c_expr(char term, struct c_ident *vars, char *token, int pop)

left = 1;
} else
if ((c >= '0' && c <= '9') || c == '\'') {
if ((c >= '0' && c <= '9') || c == '\'' || (c == '-' && !left)) {
if (c == '-') {
lookahead = c_getchar(0);
c_ungetchar(lookahead);
if (lookahead < '0' || lookahead > '9')
goto other;
token = c_gettoken();
}
value.imm = c_getint(token);
if (c == '-')
value.imm = -value.imm;
last = c_push(last, c_op_push_imm, &value);

left = 1; balance++;
Expand All @@ -552,6 +561,7 @@ static int c_expr(char term, struct c_ident *vars, char *token, int pop)
left = 0;
} else
if (c != ' ') {
other:
if (c_isident[ARCH_INDEX(c)])
var = c_find_ident(vars, NULL, token);
else
Expand Down
1 change: 1 addition & 0 deletions src/tests/test_externals.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fb58e1c442718dc91b0d6bc6faf1ec31 -
16 changes: 16 additions & 0 deletions src/tests/test_externals.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

test -n "$JOHN" || JOHN=../../run/john

set -x

for mode in `$JOHN --list=ext-modes`; do
# KDEPaste's output depends on the current time
if [ $mode != kdepaste ]; then
$JOHN --external=$mode --stdout --max-candidates=100000
fi
done

for mode in `$JOHN --list=ext-hybrids` `./john --list=ext-filters`; do
$JOHN -w --external=$mode --stdout --max-candidates=100000
done