Unit test failed
Compiled v0.18.1 with clang-17 in exaloop/llvm-project, and gfortran-10
if [ ! -d "llvm-project" ]; then
git clone --depth 1 -b codon https://github.com/exaloop/llvm-project
else
echo "OK: LLVM exists"
fi
if [ ! -d "llvm-project/install" ]; then
export LD_LIBRARY_PATH=/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
cmake -S ./llvm-project/llvm -B ./llvm-project/build \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_ENABLE_ZLIB=OFF \
-DLLVM_ENABLE_ZSTD=OFF \
-DLLVM_ENABLE_TERMINFO=OFF \
-DLLVM_TARGETS_TO_BUILD="X86;AArch64" \
-DLLVM_ENABLE_RUNTIMES="" \
-DLLVM_BUILD_TOOLS=OFF \
-DLLVM_ENABLE_LIBPFM=OFF \
-DLLVM_INCLUDE_BENCHMARKS=OFF \
-DLLVM_INCLUDE_EXAMPLES=OFF \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_ENABLE_PROJECTS="clang" \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_C_FLAGS="-fuse-ld=gold -w" \
-DCMAKE_CXX_FLAGS="-fuse-ld=gold -D_GLIBCXX_USE_CXX11_ABI=1 -w" \
-DCMAKE_LIBRARY_PATH="/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu" \
-DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=gold -L/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu" \
-DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=gold -L/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu" \
-DCMAKE_MODULE_LINKER_FLAGS="-fuse-ld=gold -L/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu"
cmake --build ./llvm-project/build -j23
cmake --install ./llvm-project/build --prefix=./llvm-project/install
else
echo "OK: LLVM installed"
fi
sudo apt install gfortran-10 libgfortran-10-dev -y
export CODON_SYSTEM_LIBRARIES=/usr/lib/x86_64-linux-gnu
if [ ! -e "/usr/lib/x86_64-linux-gnu/libgcc_s.so.1" ]; then
sudo ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
fi
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_DIR="./llvm-project/install/lib/cmake/llvm" \
-DCMAKE_C_COMPILER="$(pwd)/llvm-project/install/bin/clang" \
-DCMAKE_CXX_COMPILER="$(pwd)/llvm-project/install/bin/clang++" \
-DCMAKE_Fortran_COMPILER="gfortran-10" \
-DCMAKE_C_FLAGS="-fuse-ld=gold -w" \
-DCMAKE_CXX_FLAGS="-fuse-ld=gold -D_GLIBCXX_USE_CXX11_ABI=1 -w" \
cmake --build build --config Release -j23
cmake --install build --prefix=install
And got error on ./build/codon-test:
[ FAILED ] 24 tests, listed below:
[ FAILED ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_433_import_c_dylib, where GetParam() = ("parser/simplify_stmt.codon", true, "433_import_c_dylib", "#%% import_c_dylib,barebones\nfrom internal.dlopen import dlext\nRT = \"./libcodonrt.\" + dlext()\nif RT[-3:] == \".so\":\n RT = \"build/\" + RT[2:]\nfrom C import RT.seq_str_int(int, str, Ptr[bool]) -> str as sp\np = False\nprint sp(65, \"\", __ptr__(p)) #: 65\n\n", 424, true, false)
[ FAILED ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_941_python, where GetParam() = ("parser/simplify_stmt.codon", true, "941_python", "#%% python\nfrom python import os\nprint os.name #: posix\n\nfrom python import datetime\nz = datetime.datetime.utcfromtimestamp(0)\nprint z #: 1970-01-01 00:00:00\n\n", 933, false, false)
[ FAILED ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_961_python_numpy, where GetParam() = ("parser/simplify_stmt.codon", true, "961_python_numpy", "#%% python_numpy\nfrom python import numpy as np\na = np.arange(9).reshape(3, 3)\nprint a\n#: [[0 1 2]\n#: [3 4 5]\n#: [6 7 8]]\nprint a.dtype.name #: int64\nprint np.transpose(a)\n#: [[0 3 6]\n#: [1 4 7]\n#: [2 5 8]]\nn = np.array([[1, 2], [3, 4]])\nprint n[0], n[0][0] + 1 #: [1 2] 2\n\na = np.array([1,2,3])\nprint(a + 1) #: [2 3 4]\nprint(a - 1) #: [0 1 2]\nprint(1 - a) #: [ 0 -1 -2]\n\n", 941, false, false)
[ FAILED ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_965_python_import_fn, where GetParam() = ("parser/simplify_stmt.codon", true, "965_python_import_fn", "#%% python_import_fn\nfrom python import re.split(str, str) -> List[str] as rs\nprint rs(r'\\W+', 'Words, words, words.') #: ['Words', 'words', 'words', '']\n\n", 961, false, false)
[ FAILED ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_969_python_import_fn_2, where GetParam() = ("parser/simplify_stmt.codon", true, "969_python_import_fn_2", "#%% python_import_fn_2\nfrom python import os.system(str) -> int\nsystem(\"echo 'hello!'\") #: hello!\n\n", 965, false, false)
[ FAILED ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_975_python_pydef, where GetParam() = ("parser/simplify_stmt.codon", true, "975_python_pydef", "#%% python_pydef\n@python\ndef test_pydef(n) -> str:\n return ''.join(map(str,range(n)))\nprint test_pydef(5) #: 01234\n\n", 969, false, false)
[ FAILED ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_994_python_pydef_nested, where GetParam() = ("parser/simplify_stmt.codon", true, "994_python_pydef_nested", "#%% python_pydef_nested\ndef foo():\n @python\n def pyfoo():\n return 1\n print pyfoo() #: 1\n if True:\n @python\n def pyfoo2():\n return 2\n print pyfoo2() #: 2\n pass\n @python\n def pyfoo3():\n if 1:\n return 3\n return str(pyfoo3())\nprint foo() #: 3\n\n", 975, false, false)
[ FAILED ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_1011_python_pyobj, where GetParam() = ("parser/simplify_stmt.codon", true, "1011_python_pyobj", "#%% python_pyobj\n@python\ndef foofn() -> Dict[pyobj, pyobj]:\n return {\"str\": \"hai\", \"int\": 1}\n\nfoo = foofn()\nprint(sorted(foo.items(), key=lambda x: str(x)), foo.__class__.__name__)\n#: [('int', 1), ('str', 'hai')] Dict[pyobj,pyobj]\nfoo[\"codon\"] = 5.15\nprint(sorted(foo.items(), key=lambda x: str(x)), foo[\"codon\"].__class__.__name__, foo.__class__.__name__)\n#: [('codon', 5.15), ('int', 1), ('str', 'hai')] pyobj Dict[pyobj,pyobj]\n\na = {1: \"s\", 2: \"t\"}\na[3] = foo[\"str\"]\nprint(sorted(a.items())) #: [(1, 's'), (2, 't'), (3, 'hai')]\n\n\n", 994, false, false)
[ FAILED ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_1037_python_isinstance, where GetParam() = ("parser/simplify_stmt.codon", true, "1037_python_isinstance", "#%% python_isinstance\nimport python\n\n@python\ndef foo():\n return 1\n\nz = foo()\nprint(z.__class__.__name__) #: pyobj\n\nprint isinstance(z, pyobj) #: True\nprint isinstance(z, int) #: False\nprint isinstance(z, python.int) #: True\nprint isinstance(z, python.ValueError) #: False\n\nprint isinstance(z, (int, str, python.int)) #: True\nprint isinstance(z, (int, str, python.AttributeError)) #: False\n\ntry:\n foo().x\nexcept python.ValueError:\n pass\nexcept python.AttributeError as e:\n print('caught', e, e.__class__.__name__) #: caught 'int' object has no attribute 'x' pyobj\n\n\n", 1011, false, false)
[ FAILED ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_1070_python_exceptions, where GetParam() = ("parser/simplify_stmt.codon", true, "1070_python_exceptions", "#%% python_exceptions\nimport python\n\n@python\ndef foo():\n return 1\n\ntry:\n foo().x\nexcept python.AttributeError as f:\n print 'py.Att', f #: py.Att 'int' object has no attribute 'x'\nexcept ValueError:\n print 'Val'\nexcept PyError as e:\n print 'PyError', e\ntry:\n foo().x\nexcept python.ValueError as f:\n print 'py.Att', f\nexcept ValueError:\n print 'Val'\nexcept PyError as e:\n print 'PyError', e #: PyError 'int' object has no attribute 'x'\ntry:\n raise ValueError(\"ho\")\nexcept python.ValueError as f:\n print 'py.Att', f\nexcept ValueError:\n print 'Val' #: Val\nexcept PyError as e:\n print 'PyError', e\n\n\n", 1037, false, false)
[ FAILED ] CoreTests/SeqTest.Run/core_bltin_codon_debug, where GetParam() = ("core/bltin.codon", true, "", "", 0, false, false)
[ FAILED ] CoreTests/SeqTest.Run/core_bltin_codon, where GetParam() = ("core/bltin.codon", false, "", "", 0, false, false)
[ FAILED ] CoreTests/SeqTest.Run/core_serialization_codon_debug, where GetParam() = ("core/serialization.codon", true, "", "", 0, false, false)
[ FAILED ] CoreTests/SeqTest.Run/core_serialization_codon, where GetParam() = ("core/serialization.codon", false, "", "", 0, false, false)
[ FAILED ] StdlibTests/SeqTest.Run/stdlib_cmath_test_codon_debug, where GetParam() = ("stdlib/cmath_test.codon", true, "", "", 0, false, false)
[ FAILED ] StdlibTests/SeqTest.Run/stdlib_cmath_test_codon, where GetParam() = ("stdlib/cmath_test.codon", false, "", "", 0, false, false)
[ FAILED ] StdlibTests/SeqTest.Run/stdlib_random_test_codon_debug, where GetParam() = ("stdlib/random_test.codon", true, "", "", 0, false, false)
[ FAILED ] StdlibTests/SeqTest.Run/stdlib_random_test_codon, where GetParam() = ("stdlib/random_test.codon", false, "", "", 0, false, false)
[ FAILED ] StdlibTests/SeqTest.Run/python_pybridge_codon_debug, where GetParam() = ("python/pybridge.codon", true, "", "", 0, false, false)
[ FAILED ] StdlibTests/SeqTest.Run/python_pybridge_codon, where GetParam() = ("python/pybridge.codon", false, "", "", 0, false, false)
[ FAILED ] NumPyTests/SeqTest.Run/numpy_test_io_codon_debug, where GetParam() = ("numpy/test_io.codon", true, "", "", 0, false, false)
[ FAILED ] NumPyTests/SeqTest.Run/numpy_test_io_codon, where GetParam() = ("numpy/test_io.codon", false, "", "", 0, false, false)
[ FAILED ] NumPyTests/SeqTest.Run/numpy_test_pybridge_codon_debug, where GetParam() = ("numpy/test_pybridge.codon", true, "", "", 0, false, false)
[ FAILED ] NumPyTests/SeqTest.Run/numpy_test_pybridge_codon, where GetParam() = ("numpy/test_pybridge.codon", false, "", "", 0, false, false)
In which: Raised from: std.internal.dlopen.dlopen.2:0 /cloudide/workspace/codon-1/stdlib/internal/dlopen.codon:31:9 /cloudide/workspace/codon-1/test/main.cpp:351: Failure Value of: WIFEXITED(status) Actual: false Expected: true [ FAILED ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_941_python, where GetParam() = ("parser/simplify_stmt.codon", true, "941_python", "#%% python\nfrom python import os\nprint os.name #: posix\n\nfrom python import datetime\nz = datetime.datetime.utcfromtimestamp(0)\nprint z #: 1970-01-01 00:00:00\n\n", 933, false, false) (2767 ms) [ RUN ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_961_python_numpy CError: libpython.so: cannot open shared object file: No such file or directory
Raised from: std.internal.dlopen.dlopen.2:0 /cloudide/workspace/codon-1/stdlib/internal/dlopen.codon:31:9 /cloudide/workspace/codon-1/test/main.cpp:351: Failure Value of: WIFEXITED(status) Actual: false Expected: true [ FAILED ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_961_python_numpy, where GetParam() = ("parser/simplify_stmt.codon", true, "961_python_numpy", "#%% python_numpy\nfrom python import numpy as np\na = np.arange(9).reshape(3, 3)\nprint a\n#: [[0 1 2]\n#: [3 4 5]\n#: [6 7 8]]\nprint a.dtype.name #: int64\nprint np.transpose(a)\n#: [[0 3 6]\n#: [1 4 7]\n#: [2 5 8]]\nn = np.array([[1, 2], [3, 4]])\nprint n[0], n[0][0] + 1 #: [1 2] 2\n\na = np.array([1,2,3])\nprint(a + 1) #: [2 3 4]\nprint(a - 1) #: [0 1 2]\nprint(1 - a) #: [ 0 -1 -2]\n\n", 941, false, false) (3011 ms) [ RUN ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_965_python_import_fn CError: libpython.so: cannot open shared object file: No such file or directory
Raised from: std.internal.dlopen.dlopen.2:0 /cloudide/workspace/codon-1/stdlib/internal/dlopen.codon:31:9 /cloudide/workspace/codon-1/test/main.cpp:351: Failure Value of: WIFEXITED(status) Actual: false Expected: true [ FAILED ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_965_python_import_fn, where GetParam() = ("parser/simplify_stmt.codon", true, "965_python_import_fn", "#%% python_import_fn\nfrom python import re.split(str, str) -> List[str] as rs\nprint rs(r'\W+', 'Words, words, words.') #: ['Words', 'words', 'words', '']\n\n", 961, false, false) (2939 ms) [ RUN ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_969_python_import_fn_2 CError: libpython.so: cannot open shared object file: No such file or directory
Raised from: std.internal.dlopen.dlopen.2:0 /cloudide/workspace/codon-1/stdlib/internal/dlopen.codon:31:9 /cloudide/workspace/codon-1/test/main.cpp:351: Failure Value of: WIFEXITED(status) Actual: false Expected: true [ FAILED ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_969_python_import_fn_2, where GetParam() = ("parser/simplify_stmt.codon", true, "969_python_import_fn_2", "#%% python_import_fn_2\nfrom python import os.system(str) -> int\nsystem("echo 'hello!'") #: hello!\n\n", 965, false, false) (2785 ms) [ RUN ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_975_python_pydef CError: libpython.so: cannot open shared object file: No such file or directory
Raised from: std.internal.dlopen.dlopen.2:0 /cloudide/workspace/codon-1/stdlib/internal/dlopen.codon:31:9 /cloudide/workspace/codon-1/test/main.cpp:351: Failure Value of: WIFEXITED(status) Actual: false Expected: true [ FAILED ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_975_python_pydef, where GetParam() = ("parser/simplify_stmt.codon", true, "975_python_pydef", "#%% python_pydef\n@python\ndef test_pydef(n) -> str:\n return ''.join(map(str,range(n)))\nprint test_pydef(5) #: 01234\n\n", 969, false, false) (2747 ms) [ RUN ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_994_python_pydef_nested CError: libpython.so: cannot open shared object file: No such file or directory
Raised from: std.internal.dlopen.dlopen.2:0 /cloudide/workspace/codon-1/stdlib/internal/dlopen.codon:31:9 /cloudide/workspace/codon-1/test/main.cpp:351: Failure Value of: WIFEXITED(status) Actual: false Expected: true [ FAILED ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_994_python_pydef_nested, where GetParam() = ("parser/simplify_stmt.codon", true, "994_python_pydef_nested", "#%% python_pydef_nested\ndef foo():\n @python\n def pyfoo():\n return 1\n print pyfoo() #: 1\n if True:\n @python\n def pyfoo2():\n return 2\n print pyfoo2() #: 2\n pass\n @python\n def pyfoo3():\n if 1:\n return 3\n return str(pyfoo3())\nprint foo() #: 3\n\n", 975, false, false) (2809 ms) [ RUN ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_1011_python_pyobj CError: libpython.so: cannot open shared object file: No such file or directory
Raised from: std.internal.dlopen.dlopen.2:0 /cloudide/workspace/codon-1/stdlib/internal/dlopen.codon:31:9 /cloudide/workspace/codon-1/test/main.cpp:351: Failure Value of: WIFEXITED(status) Actual: false Expected: true [ FAILED ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_1011_python_pyobj, where GetParam() = ("parser/simplify_stmt.codon", true, "1011_python_pyobj", "#%% python_pyobj\n@python\ndef foofn() -> Dict[pyobj, pyobj]:\n return {"str": "hai", "int": 1}\n\nfoo = foofn()\nprint(sorted(foo.items(), key=lambda x: str(x)), foo.class.name)\n#: [('int', 1), ('str', 'hai')] Dict[pyobj,pyobj]\nfoo["codon"] = 5.15\nprint(sorted(foo.items(), key=lambda x: str(x)), foo["codon"].class.name, foo.class.name)\n#: [('codon', 5.15), ('int', 1), ('str', 'hai')] pyobj Dict[pyobj,pyobj]\n\na = {1: "s", 2: "t"}\na[3] = foo["str"]\nprint(sorted(a.items())) #: [(1, 's'), (2, 't'), (3, 'hai')]\n\n\n", 994, false, false) (4348 ms) [ RUN ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_1037_python_isinstance CError: libpython.so: cannot open shared object file: No such file or directory
Raised from: std.internal.dlopen.dlopen.2:0 /cloudide/workspace/codon-1/stdlib/internal/dlopen.codon:31:9 /cloudide/workspace/codon-1/test/main.cpp:351: Failure Value of: WIFEXITED(status) Actual: false Expected: true [ FAILED ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_1037_python_isinstance, where GetParam() = ("parser/simplify_stmt.codon", true, "1037_python_isinstance", "#%% python_isinstance\nimport python\n\n@python\ndef foo():\n return 1\n\nz = foo()\nprint(z.class.name) #: pyobj\n\nprint isinstance(z, pyobj) #: True\nprint isinstance(z, int) #: False\nprint isinstance(z, python.int) #: True\nprint isinstance(z, python.ValueError) #: False\n\nprint isinstance(z, (int, str, python.int)) #: True\nprint isinstance(z, (int, str, python.AttributeError)) #: False\n\ntry:\n foo().x\nexcept python.ValueError:\n pass\nexcept python.AttributeError as e:\n print('caught', e, e.class.name) #: caught 'int' object has no attribute 'x' pyobj\n\n\n", 1011, false, false) (2957 ms) [ RUN ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_1070_python_exceptions CError: libpython.so: cannot open shared object file: No such file or directory
Raised from: std.internal.dlopen.dlopen.2:0 /cloudide/workspace/codon-1/stdlib/internal/dlopen.codon:31:9 /cloudide/workspace/codon-1/test/main.cpp:351: Failure Value of: WIFEXITED(status) Actual: false Expected: true [ FAILED ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_1070_python_exceptions, where GetParam() = ("parser/simplify_stmt.codon", true, "1070_python_exceptions", "#%% python_exceptions\nimport python\n\n@python\ndef foo():\n return 1\n\ntry:\n foo().x\nexcept python.AttributeError as f:\n print 'py.Att', f #: py.Att 'int' object has no attribute 'x'\nexcept ValueError:\n print 'Val'\nexcept PyError as e:\n print 'PyError', e\ntry:\n foo().x\nexcept python.ValueError as f:\n print 'py.Att', f\nexcept ValueError:\n print 'Val'\nexcept PyError as e:\n print 'PyError', e #: PyError 'int' object has no attribute 'x'\ntry:\n raise ValueError("ho")\nexcept python.ValueError as f:\n print 'py.Att', f\nexcept ValueError:\n print 'Val' #: Val\nexcept PyError as e:\n print 'PyError', e\n\n\n", 1037, false, false) (3011 ms) [ RUN ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_1075_typeof_definition_error [ OK ] TypeTests/SeqTest.Run/parser_simplify_stmt_codon_debug_1075_typeof_definition_error (620 ms)
It looks like this is largely due to the CODON_PYTHON environment variable not being set (see the docs for reference). If you set this to the Python shared library (i.e. export CODON_PYTHON=/path/to/libpython.so) then all of those "libpython.so: cannot open shared object file: No such file or directory" errors should be resolved.