From bde16fb303aa04b9aeb3a7bb5eabe80bd11e1b05 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Mon, 7 Feb 2022 11:33:47 -0800 Subject: [PATCH] REVERT ME: Debug Python validation test failure on remote. --- .github/workflows/ci.yml | 61 +------------------ .github/workflows/lsp-tests.yml | 23 +------ .../org/lflang/tests/lsp/ErrorInserter.java | 1 + .../src/org/lflang/tests/lsp/LspTests.java | 2 +- .../generator/python/PythonValidator.java | 10 ++- .../serialization/PersonProtocolBuffers.lf | 2 +- 6 files changed, 11 insertions(+), 88 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e926b8d2fa..bcfa6413f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,66 +16,7 @@ env: vcpkgGitRef: 0bf3923f9fab4001c00f0f429682a0853b5749e0 jobs: - # Test the Maven build. - build: - uses: lf-lang/lingua-franca/.github/workflows/build.yml@master - - # Run the unit tests. - unit-tests: - uses: lf-lang/lingua-franca/.github/workflows/unit-tests.yml@master - - # Run tests for the standalone compiler. - cli-tests: - uses: lf-lang/lingua-franca/.github/workflows/cli-tests.yml@master - - # Run the C benchmark tests. - c-benchmark-tests: - uses: lf-lang/lingua-franca/.github/workflows/benchmark-tests.yml@master - with: - target: 'C' - - # Run tests for Eclipse. - eclipse-tests: - uses: lf-lang/lingua-franca/.github/workflows/eclipse-tests.yml@master # Run language server tests. lsp-tests: - uses: lf-lang/lingua-franca/.github/workflows/lsp-tests.yml@master - - # Run the C integration tests. - c-tests: - uses: lf-lang/lingua-franca/.github/workflows/c-tests.yml@master - - # Run the CCpp integration tests. - ccpp-tests: - uses: lf-lang/lingua-franca/.github/workflows/c-tests.yml@master - with: - use-cpp: true - - # Run the C++ benchmark tests. - cpp-benchmark-tests: - uses: lf-lang/lingua-franca/.github/workflows/benchmark-tests.yml@master - with: - target: 'Cpp' - - # Run the C++ integration tests. - cpp-tests: - uses: lf-lang/lingua-franca/.github/workflows/cpp-tests.yml@master - - # Run the Python integration tests. - py-tests: - uses: lf-lang/lingua-franca/.github/workflows/py-tests.yml@master - - # Run the Rust integration tests. - rs-tests: - uses: lf-lang/lingua-franca/.github/workflows/rs-tests.yml@master - - # Run the Rust benchmark tests. - rs-benchmark-tests: - uses: lf-lang/lingua-franca/.github/workflows/benchmark-tests.yml@master - with: - target: 'Rust' - - # Run the TypeScript integration tests. - ts-tests: - uses: lf-lang/lingua-franca/.github/workflows/ts-tests.yml@master + uses: lf-lang/lingua-franca/.github/workflows/lsp-tests.yml@scale-back-lsp-tests diff --git a/.github/workflows/lsp-tests.yml b/.github/workflows/lsp-tests.yml index a4ded076a0..9ff95ebd1a 100644 --- a/.github/workflows/lsp-tests.yml +++ b/.github/workflows/lsp-tests.yml @@ -7,7 +7,7 @@ jobs: run: strategy: matrix: - platform: [ubuntu-latest, macos-latest, windows-latest] + platform: [ubuntu-latest] runs-on: ${{ matrix.platform }} steps: # Uninstall operations are needed because the language server is able to use multiple @@ -29,15 +29,6 @@ jobs: uses: actions/setup-java@v1.4.3 with: java-version: 11 - - name: Setup Node.js environment - uses: actions/setup-node@v2.1.2 - - name: Install pnpm - run: npm i -g pnpm - - name: Setup Rust - uses: ATiltedTree/setup-rust@v1 - with: - rust-version: nightly - components: clippy - name: Install Dependencies Ubuntu run: | sudo apt-get install libprotobuf-dev protobuf-compiler libprotobuf-c-dev protobuf-c-compiler @@ -61,18 +52,10 @@ jobs: repository: lf-lang/lingua-franca submodules: true ref: ${{ inputs.compiler-ref }} - - name: Run language server Python tests without PyLint - run: ./gradlew test --tests org.lflang.tests.lsp.LspTests.pythonSyntaxOnlyValidationTest - - name: Report to CodeCov - uses: codecov/codecov-action@v2.1.0 - with: - file: org.lflang.tests/build/reports/xml/jacoco - fail_ci_if_error: false - verbose: true - name: Install pylint - run: python3 -m pip install pylint + run: pip install pylint==2.11.1 - name: Run language server tests - run: ./gradlew clean test --tests org.lflang.tests.lsp.LspTests.*ValidationTest + run: ./gradlew clean test --tests org.lflang.tests.lsp.LspTests.pythonValidationTest - name: Report to CodeCov uses: codecov/codecov-action@v2.1.0 with: diff --git a/org.lflang.tests/src/org/lflang/tests/lsp/ErrorInserter.java b/org.lflang.tests/src/org/lflang/tests/lsp/ErrorInserter.java index 0ddb149ccb..670c268591 100644 --- a/org.lflang.tests/src/org/lflang/tests/lsp/ErrorInserter.java +++ b/org.lflang.tests/src/org/lflang/tests/lsp/ErrorInserter.java @@ -109,6 +109,7 @@ public void write() throws IOException { throw new IOException("Failed to create a swap file."); } try (PrintWriter writer = new PrintWriter(path.toFile())) { + lines.forEach(System.out::println); // DEBUG lines.forEach(writer::println); } } diff --git a/org.lflang.tests/src/org/lflang/tests/lsp/LspTests.java b/org.lflang.tests/src/org/lflang/tests/lsp/LspTests.java index 535fcc3dd5..127ad0c126 100644 --- a/org.lflang.tests/src/org/lflang/tests/lsp/LspTests.java +++ b/org.lflang.tests/src/org/lflang/tests/lsp/LspTests.java @@ -83,7 +83,7 @@ void typescriptValidationTest() throws IOException { * @param builder A builder for the error inserter that will be used. */ private void targetLanguageValidationTest(Target target, ErrorInserter.Builder builder) throws IOException { - long seed = new Random().nextLong(); + long seed = 2943758407366436584L; System.out.printf("Running validation tests for %s with random seed %d.%n", target.getDisplayName(), seed); Random random = new Random(seed); int i = SAMPLES_PER_CATEGORY_VALIDATION_TESTS; diff --git a/org.lflang/src/org/lflang/generator/python/PythonValidator.java b/org.lflang/src/org/lflang/generator/python/PythonValidator.java index 88a67f9aeb..44bd1a2756 100644 --- a/org.lflang/src/org/lflang/generator/python/PythonValidator.java +++ b/org.lflang/src/org/lflang/generator/python/PythonValidator.java @@ -176,8 +176,7 @@ public Strategy getOutputReportingStrategy() { * * @param lines The lines of output from the compiler. * @param i The current index at which a message may start. Guaranteed to be less - * than - * {@code lines.length - 3}. + * than {@code lines.length - 3}. * @return Whether an error message was reported. */ private boolean tryReportTypical(String[] lines, int i) { @@ -243,8 +242,8 @@ public int getPriority() { @Override public LFCommand getCommand(Path generatedFile) { return LFCommand.get( - "pylint", - List.of("--output-format=json", generatedFile.getFileName().toString()), + "python3", + List.of("-m", "pylint", "--output-format=json", generatedFile.getFileName().toString()), true, fileConfig.getSrcGenPath() ); @@ -252,13 +251,12 @@ public LFCommand getCommand(Path generatedFile) { @Override public Strategy getErrorReportingStrategy() { - return (a, b, c) -> {}; + return (a, b, c) -> System.err.println(a); } @Override public Strategy getOutputReportingStrategy() { return (validationOutput, errorReporter, codeMaps) -> { - if (validationOutput.isBlank()) return; try { for (PylintMessage message : mapper.readValue(validationOutput, PylintMessage[].class)) { if (shouldIgnore(message)) continue; diff --git a/test/Python/src/serialization/PersonProtocolBuffers.lf b/test/Python/src/serialization/PersonProtocolBuffers.lf index 18f1932f98..9e5afc49a1 100644 --- a/test/Python/src/serialization/PersonProtocolBuffers.lf +++ b/test/Python/src/serialization/PersonProtocolBuffers.lf @@ -38,6 +38,6 @@ main reactor { unpacked.ParseFromString(serialized_msg) # Extract and print the unpacked message. - print("Name: ", unpacked.name) + undefined_name15291838("Name: ", unpacked.name) =} } \ No newline at end of file