@@ -820,8 +820,6 @@ class GraalPythonTags(object):
820
820
tagged_sandboxed = 'python-tagged-unittest-sandboxed'
821
821
svmunit = 'python-svm-unittest'
822
822
svmunit_sandboxed = 'python-svm-unittest-sandboxed'
823
- shared_object = 'python-so'
824
- shared_object_sandboxed = 'python-so-sandboxed'
825
823
graalvm = 'python-graalvm'
826
824
embedding = 'python-standalone-embedding'
827
825
graalvm_sandboxed = 'python-graalvm-sandboxed'
@@ -1493,14 +1491,6 @@ def graalpython_gate_runner(args, tasks):
1493
1491
if task :
1494
1492
python_checkcopyrights ([])
1495
1493
1496
- with Task ('GraalPython GraalVM shared-library build' , tasks , tags = [GraalPythonTags .shared_object , GraalPythonTags .graalvm ], report = True ) as task :
1497
- if task and not WIN32 :
1498
- run_shared_lib_test (python_so ())
1499
-
1500
- with Task ('GraalPython GraalVM sandboxed shared-library build' , tasks , tags = [GraalPythonTags .shared_object_sandboxed , GraalPythonTags .graalvm_sandboxed ], report = True ) as task :
1501
- if task :
1502
- run_shared_lib_test (python_managed_so (), ("sandboxed" ,))
1503
-
1504
1494
with Task ('GraalPython GraalVM build' , tasks , tags = [GraalPythonTags .svm , GraalPythonTags .graalvm ], report = True ) as task :
1505
1495
if task :
1506
1496
svm_image = python_svm ()
@@ -1636,147 +1626,6 @@ def graalpython_gate_runner(args, tasks):
1636
1626
mx_gate .add_gate_runner (SUITE , graalpython_gate_runner )
1637
1627
1638
1628
1639
- def run_shared_lib_test (home , args = ()):
1640
- svm_lib_path = os .path .abspath (os .path .join (home , "lib" , "polyglot" ))
1641
- fd = name = progname = None
1642
- try :
1643
- fd , name = tempfile .mkstemp (suffix = '.c' )
1644
- os .write (fd , b"""
1645
- #include "stdio.h"
1646
- #include "polyglot_api.h"
1647
-
1648
- #define assert_ok(msg, f) { if (!(f)) { \\
1649
- const poly_extended_error_info* error_info; \\
1650
- poly_get_last_error_info(isolate_thread, &error_info); \\
1651
- fprintf(stderr, "%%s\\ n", error_info->error_message); \\
1652
- return fprintf(stderr, "%%s\\ n", msg); } } while (0)
1653
-
1654
- poly_isolate global_isolate;
1655
- poly_thread isolate_thread;
1656
- poly_engine engine;
1657
- poly_context context;
1658
-
1659
- static poly_status create_context() {
1660
- poly_status status;
1661
-
1662
- if (poly_attach_thread(global_isolate, &isolate_thread)) {
1663
- return poly_generic_failure;
1664
- }
1665
-
1666
- poly_engine_builder engine_builder;
1667
- const char* permitted_languages[] = {"python"};
1668
- status = poly_create_engine_builder(isolate_thread, permitted_languages, 1, &engine_builder);
1669
- if (status != poly_ok) {
1670
- return status;
1671
- }
1672
- status = poly_engine_builder_build(isolate_thread, engine_builder, &engine);
1673
- if (status != poly_ok) {
1674
- return status;
1675
- }
1676
- poly_context_builder builder;
1677
- status = poly_create_context_builder(isolate_thread, NULL, 0, &builder);
1678
- if (status != poly_ok) {
1679
- return status;
1680
- }
1681
- status = poly_context_builder_engine(isolate_thread, builder, engine);
1682
- if (status != poly_ok) {
1683
- return status;
1684
- }
1685
- status = poly_context_builder_option(isolate_thread, builder, "python.VerboseFlag", "true");
1686
- if (status != poly_ok) {
1687
- return status;
1688
- }
1689
- #if %s
1690
- status = poly_context_builder_option(isolate_thread, builder, "llvm.managed", "true");
1691
- if (status != poly_ok) {
1692
- return status;
1693
- }
1694
- #endif
1695
- status = poly_context_builder_allow_io(isolate_thread, builder, true);
1696
- if (status != poly_ok) {
1697
- return status;
1698
- }
1699
- status = poly_context_builder_build(isolate_thread, builder, &context);
1700
- if (status != poly_ok) {
1701
- return status;
1702
- }
1703
-
1704
- return poly_ok;
1705
- }
1706
-
1707
- static poly_status tear_down_context() {
1708
- poly_status status = poly_context_close(isolate_thread, context, true);
1709
- if (status != poly_ok) {
1710
- return status;
1711
- }
1712
-
1713
- status = poly_engine_close(isolate_thread, engine, true);
1714
- if (status != poly_ok) {
1715
- return status;
1716
- }
1717
-
1718
- if (poly_detach_thread(isolate_thread)) {
1719
- return poly_ok;
1720
- }
1721
-
1722
- return poly_ok;
1723
- }
1724
-
1725
- static int test_basic_python_function() {
1726
- assert_ok("Context creation failed.", create_context() == poly_ok);
1727
-
1728
- poly_value func;
1729
- assert_ok("function eval failed", poly_context_eval(isolate_thread, context, "python", "test_func", "def test_func(x):\\ n return x * x\\ ntest_func", &func) == poly_ok);
1730
- int32_t arg_value = 42;
1731
- poly_value primitive_object;
1732
- assert_ok("create argument failed", poly_create_int32(isolate_thread, context, arg_value, &primitive_object) == poly_ok);
1733
- poly_value arg[1] = {primitive_object};
1734
- poly_value value;
1735
- assert_ok("invocation was unsuccessful", poly_value_execute(isolate_thread, func, arg, 1, &value) == poly_ok);
1736
-
1737
- int32_t result_value;
1738
- poly_value_as_int32(isolate_thread, value, &result_value);
1739
-
1740
- assert_ok("value computation was incorrect", result_value == 42 * 42);
1741
- assert_ok("Context tear down failed.", tear_down_context() == poly_ok);
1742
- return 0;
1743
- }
1744
-
1745
- int32_t main(int32_t argc, char **argv) {
1746
- poly_isolate_params isolate_params = {};
1747
- if (poly_create_isolate(&isolate_params, &global_isolate, &isolate_thread)) {
1748
- return 1;
1749
- }
1750
- return test_basic_python_function();
1751
- }
1752
- """ % (b"1" if "sandboxed" in args else b"0" ))
1753
- os .close (fd )
1754
- progname = os .path .join (SUITE .dir , "graalpython-embedded-tool" )
1755
- cc = "clang" if shutil .which ("clang" ) else "gcc"
1756
- cmdline = [cc , "-I%s" % svm_lib_path , "-L%s" % svm_lib_path , name , "-o%s" % progname , "-lpolyglot" ]
1757
- mx .log (" " .join (["Running" ] + cmdline ))
1758
- mx .run (cmdline , nonZeroIsFatal = True )
1759
- mx .log ("Running " + progname + " with LD_LIBRARY_PATH " + svm_lib_path )
1760
- mx .run (["ls" , "-l" , progname ])
1761
- mx .run (["ls" , "-l" , svm_lib_path ])
1762
- run_env = {"LD_LIBRARY_PATH" : svm_lib_path , "GRAAL_PYTHONHOME" : os .path .join (home , "languages" , "python" )}
1763
- mx .log (repr (run_env ))
1764
- mx .run ([progname ], env = run_env )
1765
- finally :
1766
- try :
1767
- os .unlink (progname )
1768
- except :
1769
- pass
1770
- try :
1771
- os .close (fd )
1772
- except :
1773
- pass
1774
- try :
1775
- os .unlink (name )
1776
- except :
1777
- pass
1778
-
1779
-
1780
1629
class ArchiveProject (mx .ArchivableProject ):
1781
1630
def __init__ (self , suite , name , deps , workingSets , theLicense , ** args ):
1782
1631
super (ArchiveProject , self ).__init__ (suite , name , deps , workingSets , theLicense )
0 commit comments