Skip to content

Commit c003467

Browse files
committed
Add testcase for mode 6
1 parent ab84519 commit c003467

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

tests/integration-test.sh

+21-1
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ def hello(arg="first"):
449449
users = [ "bob", "time", 3]
450450
return "%s,%s,%s" % (name, arg, users[0])
451451
EOF
452-
$PYTHON pyarmor.py encrypt --mode=3 -C project.zip -O test_const co_consts.py >result.log 2>&1
452+
$PYTHON pyarmor.py encrypt --mode=5 -C project.zip -O test_const co_consts.py >result.log 2>&1
453453
if [[ -f test_const/co_consts.pyc ]] ; then
454454
cd test_const
455455
grep -q "\(Module comment\|Hello\|Function comment\|jondy\|bob\|time\)" co_consts.pyc \
@@ -468,6 +468,26 @@ else
468468
csih_bug "Case 2.6 FAILED: no test_consts/co_consts.pyc found"
469469
fi
470470

471+
csih_inform "Case 2.7: verify mode 6 works"
472+
$PYTHON pyarmor.py encrypt --mode=6 -C project.zip -O test_mode6 co_consts.py >result.log 2>&1
473+
if [[ -f test_mode6/co_consts.pyc ]] ; then
474+
cd test_mode6
475+
grep -q "\(Module comment\|Hello\|Function comment\|jondy\|bob\|time\)" co_consts.pyc \
476+
&& csih_bug "Case 2.7 FAILED: co_consts still in clear text"
477+
cat <<EOF > main.py
478+
import pyimcore
479+
import sys
480+
import co_consts
481+
sys.stdout.write("%s:%s:%s" % (co_consts.title, co_consts.__doc__, co_consts.hello("second")))
482+
EOF
483+
$PYTHON main.py >result.log 2>&1 || csih_bug "Case 2.7 FAILED: run script return non-zero code"
484+
grep -q "Hello:Module comment:jondy,second,bob" result.log \
485+
|| csih_bug "Case 2.7 FAILED: python script returns unexpected result"
486+
cd ..
487+
else
488+
csih_bug "Case 2.7 FAILED: no test_mode6/co_consts.pyc found"
489+
fi
490+
471491
#
472492
# Import encrypted module and run encrypted scripts
473493
#

0 commit comments

Comments
 (0)