root icon indicating copy to clipboard operation
root copied to clipboard

[cling] Windows: Fix declaration for C99 and re-enable Gnu.C test

Open ferdymercury opened this issue 1 year ago • 20 comments

This Pull request:

Changes or fixes:

This is a rebased version of https://github.com/root-project/cling/pull/174 by @marsupial The test was failing for a reason that likely shouldn't be ignored. This reverts commit https://github.com/root-project/cling/commit/5947e13cb99052b6f7a5b501244ee2be9be9d080.

Checklist:

  • [ ] tested changes locally
  • [ ] updated the docs (if necessary)

ferdymercury avatar Oct 15 '24 17:10 ferdymercury

Test Results

    21 files      21 suites   3d 21h 20m 24s ⏱️  3 781 tests  3 774 ✅ 0 💤 7 ❌ 77 745 runs  77 738 ✅ 0 💤 7 ❌

For more details on these failures, see this check.

Results for commit b605efce.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Oct 16 '24 01:10 github-actions[bot]

Do we have a way to run the cling tests in the ci?

vgvassilev avatar Oct 17 '24 05:10 vgvassilev

Do we have a way to run the cling tests in the ci?

That would be https://github.com/root-project/root/issues/15230

ferdymercury avatar Oct 17 '24 06:10 ferdymercury

Do we have a way to run the cling tests in the ci?

That would be #15230

Ok, so it's not there yet. @ferdymercury, did you try to run the cling tests locally? Does this change still lead to successful testsuite?

vgvassilev avatar Oct 17 '24 06:10 vgvassilev

No, I didn't, sorry. I just rebased an existing PR, I think at that time, it was tested with jenkins. See discussion here: https://github.com/root-project/cling/pull/174#issuecomment-313743374

ferdymercury avatar Oct 17 '24 06:10 ferdymercury

No, I didn't, sorry. I just rebased an existing PR, I think at that time, it was tested with jenkins. See discussion here: root-project/cling#174 (comment)

Ok, 7 years ago the tests were fine. Are they now? We should probably implement the feature request you mentioned earlier.

vgvassilev avatar Oct 17 '24 06:10 vgvassilev

I am not sure: @vgvassilev are we good to merge or not?

dpiparo avatar Oct 19 '24 17:10 dpiparo

I think he meant not to merge this one before someone takes care of https://github.com/root-project/root/issues/15230

ferdymercury avatar Oct 19 '24 20:10 ferdymercury

Unless @bellenot and @devajithvs can run cling-tests locally on Windows and Mac/Linux to check for this PR, we should wait for https://github.com/root-project/root/pull/18127 before merge.

ferdymercury avatar Nov 24 '25 17:11 ferdymercury

Here is what I get on Windows. Is this supposed to work at all?

C:\root-dev\build\x64\relwithdebinfo>ctest -VV -C RelWithDebInfo -R clingtest-check-cling
UpdateCTestConfiguration  from :C:/root-dev/build/x64/relwithdebinfo/DartConfiguration.tcl
Parse Config file:C:/root-dev/build/x64/relwithdebinfo/DartConfiguration.tcl
Test project C:/root-dev/build/x64/relwithdebinfo
Constructing a list of tests
Ignore test: test-tcollex
Ignore test: roottest-cling-parsing-semicolon
Ignore test: roottest-root-rint-TabCom
Ignore test: roottest-root-rint-BackslashNewline
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 1
    Start 1: clingtest-check-cling

1: Test command: "C:\Program Files\CMake\bin\cmake.exe" "-DCMD=C:/Program Files/CMake/bin/cmake.exe^--build^C:/root-dev/build/x64/relwithdebinfo^--target^check-cling" "-DSYS=C:/root-dev/build/x64/relwithdebinfo" "-P" "C:/root-dev/git/master/cmake/modules/RootTestDriver.cmake"
1: Working Directory: C:/root-dev/build/x64/relwithdebinfo/interpreter
1: Environment variables:
1:  ROOT_HIST=0
1: Test timeout computed to be: 1500
1: Change Dir: 'C:/root-dev/build/x64/relwithdebinfo'
1:
1: Run Build Command(s): "C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe" check-cling.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=17.0 /v:n
1: MSBuild version 17.13.19+0d9f5a35a for .NET Framework
1: MSBUILD : error MSB1009: Project file does not exist.
1: Switch: check-cling.vcxproj
1:
1: CMake Error at C:/root-dev/git/master/cmake/modules/RootTestDriver.cmake:232 (message):
1:   error code: 1
1:
1:
1/1 Test #1: clingtest-check-cling ............***Failed    1.10 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) =   1.74 sec

The following tests FAILED:
          1 - clingtest-check-cling (Failed)
Errors while running CTest

bellenot avatar Nov 25 '25 10:11 bellenot

Here is what I get on Windows. Is this supposed to work at all?

I vaguely remember that in Windows it only works to test it with bare cling, not inside ROOT, but not sure.

ferdymercury avatar Nov 25 '25 10:11 ferdymercury

I vaguely remember that in Windows it only works to test it with bare cling, not inside ROOT, but not sure.

OK, I'll try with Cling

bellenot avatar Nov 25 '25 11:11 bellenot

So first, the standalone cling build is broken on Windows (there is a PR for this https://github.com/root-project/root/pull/20514), then building the check-cling target is also broken:

         Running the Cling regression tests
         C:\Python311\python.exe: can't open file 'C:\\root-dev\\build\\x64\\cling\\bin\\llvm-lit.py': [Errno 2] No such file or directory

and finally, after copying the file where needed, check-cling is still broken:

         Running the Cling regression tests
         llvm-lit.py: C:\root-dev\git\llvm-project\llvm\utils\lit\lit\llvm\config.py:57: note: using lit tools: C:\Program Files\Git\usr\bin
         llvm-lit.py: C:\root-dev\git\llvm-project\llvm\utils\lit\lit\TestingConfig.py:156: fatal: unable to parse config file 'C:/root-dev/git/cling/test/lit.cfg', traceback: Traceback (most recent call last):
           File "C:\root-dev\git\llvm-project\llvm\utils\lit\lit\TestingConfig.py", line 144, in load_from_path
             exec(compile(data, path, "exec"), cfg_globals, None)
           File "C:/root-dev/git/cling/test/lit.cfg", line 20, in <module>
             if IsWindows and not execute_external:
                                  ^^^^^^^^^^^^^^^^
         NameError: name 'execute_external' is not defined

So it will take some time to figure out what's wrong

bellenot avatar Nov 25 '25 15:11 bellenot

So check-cling doesn't work at all on Windows, and I'm not going to fix it for the time being

bellenot avatar Nov 25 '25 15:11 bellenot

The test seems to be passing on linux, atleast locally. For https://github.com/root-project/root/pull/18127, some tests are broken again (unrelated to this PR). I am looking into that.

devajithvs avatar Nov 26 '25 08:11 devajithvs

So check-cling doesn't work at all on Windows, and I'm not going to fix it for the time being

Thanks Bertrand for checking though.

One last question for Windows, is it possible to run (before versus after recompiling with this branch) just this test file by hand from terminal?

I mean executing the lines from CMD:

cling -D__STRICT_ANSI__ -std=gnu++14 -Xclang -verify 2>&1
cling -D__STRICT_ANSI__ -std=gnu++1z -Xclang -verify 2>&1
cling (before nothing, after --noruntime) -D__STRICT_ANSI__ -std=gnu++11 -Xclang -verify 2>&1

and then copy pasting the file contents, or using cat to feed it there.

ferdymercury avatar Nov 26 '25 08:11 ferdymercury

@ferdymercury sure! Here is are results:

C:\root-dev\build\x64\cling>type Gnu.C | bin\cling.exe -D__STRICT_ANSI__ -std=gnu++14 -Xclang -verify 2>&1

****************** CLING ******************
* Type C++ code and press enter to run it *
*     Type .? for help and .q to exit     *
*******************************************
TEST: 22 'THIS'

C:\root-dev\build\x64\cling>type Gnu.C | bin\cling.exe -D__STRICT_ANSI__ -std=gnu++1z -Xclang -verify 2>&1

****************** CLING ******************
* Type C++ code and press enter to run it *
*     Type .? for help and .q to exit     *
*******************************************
TEST: 22 'THIS'

C:\root-dev\build\x64\cling>type Gnu.C | bin\cling.exe -D__STRICT_ANSI__ -std=gnu++11 -Xclang -verify 2>&1

****************** CLING ******************
* Type C++ code and press enter to run it *
*     Type .? for help and .q to exit     *
*******************************************
IncrementalExecutor::executeFunction: symbol '?printf@@YAHPEBDZZ' unresolved while linking [cling interface function]!
You are probably missing the definition of int __cdecl printf(char const * __ptr64,...)
Maybe you need to load the corresponding shared library?
error: 'expected-error' diagnostics seen but not expected:
  File C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\type_traits Line 0: 'auto' return without trailing return type; deduced return types are a C++14 extension

C:\root-dev\build\x64\cling>type Gnu.C | bin\cling.exe --noruntime -D__STRICT_ANSI__ -std=gnu++11 -Xclang -verify 2>&1

****************** CLING ******************
* Type C++ code and press enter to run it *
*     Type .? for help and .q to exit     *
*******************************************
TEST: 22 'THIS'

C:\root-dev\build\x64\cling>

bellenot avatar Nov 26 '25 08:11 bellenot

@ferdymercury P.S. Note that I obtain the same results with or without the changes in Interpreter.cpp...

bellenot avatar Nov 26 '25 09:11 bellenot

Thanks a lot! Interesting. So maybe the changes in Interpreter.Cpp were needed for old VisualStudio versions from year 2017 but not any more? (See https://github.com/root-project/cling/pull/174)

ferdymercury avatar Nov 26 '25 09:11 ferdymercury

Thanks a lot! Interesting. So maybe the changes in Interpreter.Cpp were needed for old VisualStudio versions from year 2017 but not any more? (See root-project/cling#174)

Maybe. I'll try with VS 2019 (at home) and I'll let you know. I don't have any older version... :wink:

bellenot avatar Nov 26 '25 09:11 bellenot