Skip to content

Commit d4fb26f

Browse files
committed
[GR-23280][GR-23303][GR-23331][GR-23332] Pass more leftover app scripting tests
PullRequest: graalpython/1644
2 parents 6a9d64f + ba4723d commit d4fb26f

File tree

9 files changed

+73
-4
lines changed

9 files changed

+73
-4
lines changed

graalpython/com.oracle.graal.python.shell/src/com/oracle/graal/python/shell/GraalPythonMain.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ private static void printShortHelp() {
351351
}
352352

353353
private static void print(String string) {
354-
System.out.println(string);
354+
System.err.println(string);
355355
}
356356

357357
private static String getLauncherExecName() {
@@ -703,7 +703,7 @@ protected String getLanguageId() {
703703

704704
@Override
705705
protected void printHelp(OptionCategory maxCategory) {
706-
print("usage: python [option] ... (-c cmd | file) [arg] ...\n" +
706+
System.out.println("usage: python [option] ... (-c cmd | file) [arg] ...\n" +
707707
"Options and arguments (and corresponding environment variables):\n" +
708708
"-B : this disables writing .py[co] files on import\n" +
709709
"-c cmd : program passed in as string (terminates option list)\n" +

graalpython/com.oracle.graal.python.test/src/tests/test_tagged_unittests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def test_tagged():
8484
cmd.append("--inspect")
8585
if "-debug-java" in sys.argv:
8686
cmd.append("-debug-java")
87-
cmd += ["-S", RUNNER]
87+
cmd += [RUNNER]
8888
for testpattern in working_test[1]:
8989
cmd.extend(["-k", testpattern])
9090
print("Running test:", working_test[0])
@@ -201,7 +201,7 @@ def main():
201201
# (there will be one even if everything succeeds) filter out possible false-passes caused by
202202
# the tests catching all exceptions somewhere
203203
cmd += ['--experimental-options', '--python.CatchAllExceptions']
204-
cmd += ["-S", RUNNER, "-v"]
204+
cmd += [RUNNER, "-v"]
205205
tagfile = os.path.join(TAGS_DIR, testfile_stem + ".txt")
206206
if retag and repeat == 0:
207207
test_selectors = []

graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_builtin.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
*graalpython.lib-python.3.test.test_builtin.PtyTests.test_input_tty
6161
*graalpython.lib-python.3.test.test_builtin.PtyTests.test_input_tty_non_ascii
6262
*graalpython.lib-python.3.test.test_builtin.PtyTests.test_input_tty_non_ascii_unicode_errors
63+
*graalpython.lib-python.3.test.test_builtin.ShutdownTest.test_cleanup
6364
*graalpython.lib-python.3.test.test_builtin.TestBreakpoint.test_breakpoint
6465
*graalpython.lib-python.3.test.test_builtin.TestBreakpoint.test_breakpoint_with_args_and_keywords
6566
*graalpython.lib-python.3.test.test_builtin.TestBreakpoint.test_breakpoint_with_breakpointhook_reset

graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_richcmp.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*graalpython.lib-python.3.test.test_richcmp.MiscTest.test_exception_message
66
*graalpython.lib-python.3.test.test_richcmp.MiscTest.test_misbehavin
77
*graalpython.lib-python.3.test.test_richcmp.MiscTest.test_not
8+
*graalpython.lib-python.3.test.test_richcmp.MiscTest.test_recursion
89
*graalpython.lib-python.3.test.test_richcmp.NumberTest.test_basic
910
*graalpython.lib-python.3.test.test_richcmp.NumberTest.test_values
1011
*graalpython.lib-python.3.test.test_richcmp.VectorTest.test_mixed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
*graalpython.lib-python.3.test.test_site.HelperFunctionsTests.test__getuserbase
2+
*graalpython.lib-python.3.test.test_site.HelperFunctionsTests.test_addpackage
3+
*graalpython.lib-python.3.test.test_site.HelperFunctionsTests.test_addpackage_import_bad_exec
4+
*graalpython.lib-python.3.test.test_site.HelperFunctionsTests.test_addpackage_import_bad_pth_file
5+
*graalpython.lib-python.3.test.test_site.HelperFunctionsTests.test_addpackage_import_bad_syntax
6+
*graalpython.lib-python.3.test.test_site.HelperFunctionsTests.test_addsitedir
7+
*graalpython.lib-python.3.test.test_site.HelperFunctionsTests.test_get_path
8+
*graalpython.lib-python.3.test.test_site.HelperFunctionsTests.test_getuserbase
9+
*graalpython.lib-python.3.test.test_site.HelperFunctionsTests.test_getusersitepackages
10+
*graalpython.lib-python.3.test.test_site.HelperFunctionsTests.test_init_pathinfo
11+
*graalpython.lib-python.3.test.test_site.HelperFunctionsTests.test_makepath
12+
*graalpython.lib-python.3.test.test_site.HelperFunctionsTests.test_no_home_directory
13+
*graalpython.lib-python.3.test.test_site.HelperFunctionsTests.test_s_option
14+
*graalpython.lib-python.3.test.test_site.ImportSideEffectTests.test_abs_paths_cached_None
15+
*graalpython.lib-python.3.test.test_site.ImportSideEffectTests.test_add_build_dir
16+
*graalpython.lib-python.3.test.test_site.ImportSideEffectTests.test_aliasing_mbcs
17+
*graalpython.lib-python.3.test.test_site.ImportSideEffectTests.test_license_exists_at_url
18+
*graalpython.lib-python.3.test.test_site.ImportSideEffectTests.test_no_duplicate_paths
19+
*graalpython.lib-python.3.test.test_site.ImportSideEffectTests.test_setting_copyright
20+
*graalpython.lib-python.3.test.test_site.ImportSideEffectTests.test_setting_help
21+
*graalpython.lib-python.3.test.test_site.ImportSideEffectTests.test_setting_quit
22+
*graalpython.lib-python.3.test.test_site.ImportSideEffectTests.test_sitecustomize_executed
23+
*graalpython.lib-python.3.test.test_site.StartupImportTests.test_startup_interactivehook
24+
*graalpython.lib-python.3.test.test_site.StartupImportTests.test_startup_interactivehook_isolated
25+
*graalpython.lib-python.3.test.test_site.StartupImportTests.test_startup_interactivehook_isolated_explicit
26+
*graalpython.lib-python.3.test.test_site._pthFileTests.test_underpth_dll_file
27+
*graalpython.lib-python.3.test.test_site._pthFileTests.test_underpth_file
28+
*graalpython.lib-python.3.test.test_site._pthFileTests.test_underpth_nosite_file

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/ImpModuleBuiltins.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,11 @@ PBytes run(long magicNumber, PBytesLike source) {
609609
PBytes run(PInt magicNumber, PBytesLike source) {
610610
return run(magicNumber.longValue(), source);
611611
}
612+
613+
@Specialization
614+
PBytes run(int magicNumber, PBytesLike source) {
615+
return run((long) magicNumber, source);
616+
}
612617
}
613618

614619
@Builtin(name = "_fix_co_filename", minNumOfPositionalArgs = 2)

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/common/SequenceStorageNodes.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
import com.oracle.graal.python.util.OverflowException;
162162
import com.oracle.graal.python.util.PythonUtils;
163163
import com.oracle.graal.python.util.Supplier;
164+
import com.oracle.truffle.api.CompilerAsserts;
164165
import com.oracle.truffle.api.CompilerDirectives;
165166
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
166167
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
@@ -1980,6 +1981,17 @@ private LenNode getLenNode() {
19801981
return lenNode;
19811982
}
19821983

1984+
private static final boolean testingEqualsWithDifferingLengths(int llen, int rlen, BinCmpOp op) {
1985+
// shortcut: if the lengths differ, the lists differ.
1986+
CompilerAsserts.compilationConstant(op);
1987+
if (op == Eq.INSTANCE) {
1988+
if (llen != rlen) {
1989+
return true;
1990+
}
1991+
}
1992+
return false;
1993+
}
1994+
19831995
@SuppressWarnings("unused")
19841996
@Specialization(guards = {"isEmpty(left)", "isEmpty(right)"})
19851997
boolean doEmpty(SequenceStorage left, SequenceStorage right) {
@@ -1990,6 +2002,9 @@ boolean doEmpty(SequenceStorage left, SequenceStorage right) {
19902002
boolean doBoolStorage(BoolSequenceStorage left, BoolSequenceStorage right) {
19912003
int llen = left.length();
19922004
int rlen = right.length();
2005+
if (testingEqualsWithDifferingLengths(llen, rlen, cmpOp)) {
2006+
return false;
2007+
}
19932008
for (int i = 0; i < Math.min(llen, rlen); i++) {
19942009
int litem = PInt.intValue(left.getBoolItemNormalized(i));
19952010
int ritem = PInt.intValue(right.getBoolItemNormalized(i));
@@ -2004,6 +2019,9 @@ boolean doBoolStorage(BoolSequenceStorage left, BoolSequenceStorage right) {
20042019
boolean doByteStorage(ByteSequenceStorage left, ByteSequenceStorage right) {
20052020
int llen = left.length();
20062021
int rlen = right.length();
2022+
if (testingEqualsWithDifferingLengths(llen, rlen, cmpOp)) {
2023+
return false;
2024+
}
20072025
for (int i = 0; i < Math.min(llen, rlen); i++) {
20082026
byte litem = left.getByteItemNormalized(i);
20092027
byte ritem = right.getByteItemNormalized(i);
@@ -2018,6 +2036,9 @@ boolean doByteStorage(ByteSequenceStorage left, ByteSequenceStorage right) {
20182036
boolean doIntStorage(IntSequenceStorage left, IntSequenceStorage right) {
20192037
int llen = left.length();
20202038
int rlen = right.length();
2039+
if (testingEqualsWithDifferingLengths(llen, rlen, cmpOp)) {
2040+
return false;
2041+
}
20212042
for (int i = 0; i < Math.min(llen, rlen); i++) {
20222043
int litem = left.getIntItemNormalized(i);
20232044
int ritem = right.getIntItemNormalized(i);
@@ -2032,6 +2053,9 @@ boolean doIntStorage(IntSequenceStorage left, IntSequenceStorage right) {
20322053
boolean doLongStorage(LongSequenceStorage left, LongSequenceStorage right) {
20332054
int llen = left.length();
20342055
int rlen = right.length();
2056+
if (testingEqualsWithDifferingLengths(llen, rlen, cmpOp)) {
2057+
return false;
2058+
}
20352059
for (int i = 0; i < Math.min(llen, rlen); i++) {
20362060
long litem = left.getLongItemNormalized(i);
20372061
long ritem = right.getLongItemNormalized(i);
@@ -2046,6 +2070,9 @@ boolean doLongStorage(LongSequenceStorage left, LongSequenceStorage right) {
20462070
boolean doDoubleStorage(DoubleSequenceStorage left, DoubleSequenceStorage right) {
20472071
int llen = left.length();
20482072
int rlen = right.length();
2073+
if (testingEqualsWithDifferingLengths(llen, rlen, cmpOp)) {
2074+
return false;
2075+
}
20492076
for (int i = 0; i < Math.min(llen, rlen); i++) {
20502077
double litem = left.getDoubleItemNormalized(i);
20512078
double ritem = right.getDoubleItemNormalized(i);
@@ -2062,6 +2089,9 @@ boolean doGeneric(VirtualFrame frame, SequenceStorage left, SequenceStorage righ
20622089
@CachedLibrary(limit = "getCallSiteInlineCacheMaxDepth()") PythonObjectLibrary lib) {
20632090
int llen = getLenNode().execute(left);
20642091
int rlen = getLenNode().execute(right);
2092+
if (testingEqualsWithDifferingLengths(llen, rlen, cmpOp)) {
2093+
return false;
2094+
}
20652095
ThreadState state;
20662096
if (hasFrame.profile(frame != null)) {
20672097
state = PArguments.getThreadState(frame);

graalpython/lib-python/3/test/test_builtin.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,6 +1989,7 @@ def test_baddecorator(self):
19891989

19901990
class ShutdownTest(unittest.TestCase):
19911991

1992+
@impl_detail("finalization", graalvm=False)
19921993
def test_cleanup(self):
19931994
# Issue #19255: builtins are still available at shutdown
19941995
code = """if 1:

graalpython/lib-python/3/test/test_site.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
if sys.flags.no_site:
3131
raise unittest.SkipTest("Python was invoked with -S")
3232

33+
# Make sure sysconfig._CONFIG_VARS is initialized for the tests below
34+
sysconfig.get_config_vars()
35+
3336
import site
3437

3538

0 commit comments

Comments
 (0)