Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run MacOS tests in correct directory. #3718

Merged
merged 6 commits into from
Dec 16, 2022
Merged

Run MacOS tests in correct directory. #3718

merged 6 commits into from
Dec 16, 2022

Conversation

fruffy
Copy link
Collaborator

@fruffy fruffy commented Nov 22, 2022

Turns out MacOS tests have not run in a while. ctest was not executed in the right folder.

@fruffy
Copy link
Collaborator Author

fruffy commented Nov 22, 2022

Anyone with a MacOS setup able to debug the CI failure? I am not sure what to do here.

@rst0git
Copy link
Member

rst0git commented Nov 23, 2022

Anyone with a MacOS setup able to debug the CI failure? I am not sure what to do here.

1375/1919 Test    #1: driver_inputs_test_1 ............................................................***Failed    0.08 sec
/Users/runner/work/p4c/p4c/tools/driver/test_scripts/driver_inputs_test_1: line 7: realpath: command not found
/Users/runner/work/p4c/p4c/tools/driver/test_scripts/driver_inputs_test_1: line 7: ./driver_inputs_test___shared_code.bash: No such file or directory
/Users/runner/work/p4c/p4c/tools/driver/test_scripts/driver_inputs_test_1: line 9: check_for_inadvisable_sourcing: command not found
/Users/runner/work/p4c/p4c/tools/driver/test_scripts/driver_inputs_test_1: line 10: return: can only `return' from a function or sourced script
/Users/runner/work/p4c/p4c/tools/driver/test_scripts/driver_inputs_test_1: line 14: resolve_symlink_only_of_basename: command not found
/Users/runner/work/p4c/p4c/tools/driver/test_scripts/driver_inputs_test_1: line 18: try_to_find_the_driver: command not found
Unable to find the driver of the P4 compiler.  Aborting the test '''' with a non-zero exit code.  This test failed.

It looks like we need to add coreutils to the list of dependencies in install_mac_deps.sh

@fruffy
Copy link
Collaborator Author

fruffy commented Nov 23, 2022

Anyone with a MacOS setup able to debug the CI failure? I am not sure what to do here.

1375/1919 Test    #1: driver_inputs_test_1 ............................................................***Failed    0.08 sec
/Users/runner/work/p4c/p4c/tools/driver/test_scripts/driver_inputs_test_1: line 7: realpath: command not found
/Users/runner/work/p4c/p4c/tools/driver/test_scripts/driver_inputs_test_1: line 7: ./driver_inputs_test___shared_code.bash: No such file or directory
/Users/runner/work/p4c/p4c/tools/driver/test_scripts/driver_inputs_test_1: line 9: check_for_inadvisable_sourcing: command not found
/Users/runner/work/p4c/p4c/tools/driver/test_scripts/driver_inputs_test_1: line 10: return: can only `return' from a function or sourced script
/Users/runner/work/p4c/p4c/tools/driver/test_scripts/driver_inputs_test_1: line 14: resolve_symlink_only_of_basename: command not found
/Users/runner/work/p4c/p4c/tools/driver/test_scripts/driver_inputs_test_1: line 18: try_to_find_the_driver: command not found
Unable to find the driver of the P4 compiler.  Aborting the test '''' with a non-zero exit code.  This test failed.

It looks like we need to add coreutils to the list of dependencies in install_mac_deps.sh

Do you have an idea what is causing the remaining JSON CI failure? The grep does not produce an output it seems.

@davidbolvansky
Copy link
Contributor

2022-11-23T18:35:54.7364120Z 1597/1921 Test #1968: gtestp4c ........................................................................***Failed   41.50 sec
2022-11-23T18:35:54.7365390Z [==========] Running 132 tests from 23 test cases.
2022-11-23T18:35:54.7366170Z [----------] Global test environment set-up.
2022-11-23T18:35:54.7366800Z [----------] 9 tests from P4CArchitecture
2022-11-23T18:35:54.7367300Z [ RUN      ] P4CArchitecture.packet_out
2022-11-23T18:35:54.7367810Z [       OK ] P4CArchitecture.packet_out (3 ms)
2022-11-23T18:35:54.7368350Z [ RUN      ] P4CArchitecture.duplicatedDeclarationBug
2022-11-23T18:35:54.7369070Z (string)(19): [--Werror=duplicate] error: Deparser: multiple matching declarations
2022-11-23T18:35:54.7369600Z         PSA(Deparser()) main;
2022-11-23T18:35:54.7370010Z             ^^^^^^^^
2022-11-23T18:35:54.7370630Z (string)(7): [--Werror=duplicate] error: Candidate: control Deparser
2022-11-23T18:35:54.7371170Z         control Deparser<H> (packet_out b, in H hdr);
2022-11-23T18:35:54.7371620Z                 ^^^^^^^^
2022-11-23T18:35:54.7372230Z (string)(14): [--Werror=duplicate] error: Candidate: control Deparser
2022-11-23T18:35:54.7372780Z         control Deparser(packet_out b, in ParsedHeaders h){
2022-11-23T18:35:54.7373240Z                 ^^^^^^^^
2022-11-23T18:35:54.7373980Z [       OK ] P4CArchitecture.duplicatedDeclarationBug (0 ms)
2022-11-23T18:35:54.7374570Z [ RUN      ] P4CArchitecture.instantiation
2022-11-23T18:35:54.7375090Z [       OK ] P4CArchitecture.instantiation (3 ms)
2022-11-23T18:35:54.7375420Z [ RUN      ] P4CArchitecture.psa_package_with_body
2022-11-23T18:35:54.7375720Z (string)(5):syntax error, unexpected {, expecting ;
2022-11-23T18:35:54.7376220Z         package PSA<H, M> (Ingress<H, M> ig) {

@rst0git
Copy link
Member

rst0git commented Nov 25, 2022

@davidbolvansky load_ir_from_json is the test that currently fails:

[ RUN      ] FromJSONTest.load_ir_from_json
105,112d104
<       "name" : "X",
<       "entries" : [
<         ["Field_0", 0],
<         ["Field_1", 1],
<         ["Field_2", 2]
<       ]
<     },
<     {
118a111,118
>     },
>     {
>       "name" : "X",
>       "entries" : [
>         ["Field_0", 0],
>         ["Field_1", 1],
>         ["Field_2", 2]
>       ]
/Users/runner/work/p4c/p4c/test/gtest/load_ir_from_json.cpp:51: Failure
Value of: exitCode
  Actual: true
Expected: false
[  FAILED  ] FromJSONTest.load_ir_from_json (1352 ms)
All commands have been installed with the prefix "g".
If you need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:
  PATH="/usr/local/opt/grep/libexec/gnubin:$PATH"

It looks like we need to add the following line to make sure that the tests are using the GNU version of grep.

export PATH="/usr/local/opt/grep/libexec/gnubin:$PATH"

@rst0git
Copy link
Member

rst0git commented Nov 28, 2022

When comparing the output of outputTO.json and outputFROM.json for the load_ir_from_json test running in CI, it looks like the order of "X" and "Y" has been swapped. This is causing the diff test to fail:

outputTO.json:

  "enums" : [
    {
      "name" : "X",
      "entries" : [
        ["Field_0", 0],
        ["Field_1", 1],
        ["Field_2", 2]
      ]
    },
    {
      "name" : "Y",
      "entries" : [
        ["Field_00", 0],
        ["Field_01", 1],
        ["Field_02", 2]
      ]
    }
  ],

outputFROM.json:

  "enums" : [
    {
      "name" : "Y",
      "entries" : [
        ["Field_00", 0],
        ["Field_01", 1],
        ["Field_02", 2]
      ]
    },
    {
      "name" : "X",
      "entries" : [
        ["Field_0", 0],
        ["Field_1", 1],
        ["Field_2", 2]
      ]
    }
  ],

@fruffy
Copy link
Collaborator Author

fruffy commented Nov 28, 2022

Hm could this be some non-determinism in the JSONGenerator?

@mihaibudiu
Copy link
Contributor

Ideally it would generate fields in alphabetical order.

@fruffy
Copy link
Collaborator Author

fruffy commented Nov 28, 2022

It could either be the loader or generator, but I do not understand that code well enough yet to tell.

@davidbolvansky
Copy link
Contributor

If this is hard to debug - maybe just disable this test for now to unblock this PR?

@fruffy
Copy link
Collaborator Author

fruffy commented Dec 15, 2022

Done.

run: |
ctest --output-on-failure -j 2 --schedule-random -LE "bpf$"
ctest --output-on-failure -j 2 --schedule-random -LE "bpf|gtest|ubpf"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop -j2.

CTEST_PARALLEL_LEVEL is defined.

@@ -141,5 +141,7 @@ jobs:
./bootstrap.sh -DENABLE_GC=ON -DCMAKE_BUILD_TYPE=RELEASE -DENABLE_UNIFIED_COMPILATION=ON && cd build && make -j2

- name: Run tests (MacOS)
# TODO: Renable gtest. Unit tests currently fail on MacOS.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fruffy Would you be able to open a GitHub issue describing the problem and add a link in the comment, or we could add a link to this pull request?

@fruffy fruffy merged commit b8e80bf into main Dec 16, 2022
@fruffy fruffy deleted the fruffy/macos_tests branch December 19, 2022 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants