Skip to content

Reenable terminal tests on CI #5018

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

Closed
wants to merge 3 commits into from

Conversation

Blaisorblade
Copy link
Contributor

@Blaisorblade Blaisorblade commented Aug 25, 2018

The issue is discussed at #4952 (comment):
console tries to open a terminal, on CI we can only open dumb ones, but we configured JLine to fail then. If we don't, the tests pass.

Since opening dumb terminals is necessary in real usecases where the terminal emulator is limited, this might be good to go; otherwise we can only enable dumb terminals in CI.

/cc @SzymonPajzert: is this fix sufficient for your testing goals? We aren't doing that much testing yet...

@Blaisorblade Blaisorblade self-assigned this Aug 25, 2018
@@ -1,4 +1,4 @@
> run
> 'set initialCommands := "1 + 1" '
# FIXME: does not work on the CI
#> console
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks.

This should probably be a setting for CI, but first testing what happens.
@Blaisorblade
Copy link
Contributor Author

Oh, the last failure is spurious (#5021) but the actual issue is fixed!
Issue shown at: http://dotty-ci.epfl.ch/lampepfl/dotty/7070/6
And fixed in: http://dotty-ci.epfl.ch/lampepfl/dotty/7072/6

@Blaisorblade Blaisorblade changed the title WIP Reenable terminal tests on CI Reenable terminal tests on CI Aug 26, 2018
event: [ tag, deployment ]
# when:
# # sbt scripted tests are slow and only run on nightly or deployment
# event: [ tag, deployment ]
Copy link
Contributor

Choose a reason for hiding this comment

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

This need to be reverted

@@ -18,7 +18,6 @@ final class JLineTerminal extends java.io.Closeable {
// Logger.getLogger("org.jline").setLevel(Level.FINEST)

private val terminal = TerminalBuilder.builder()
.dumb(false) // fail early if not able to create a terminal
Copy link
Contributor

Choose a reason for hiding this comment

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

I am against enabling this by default. Last time I tried, the dumb terminal was very limited and I don't want to expose it to users. E.g.

  • no syntax highlighting
  • no history
  • no auto-completion
  • no multi-line editing

You can experiment with dumb terminal with these changes:

diff --git a/compiler/src/dotty/tools/repl/JLineTerminal.scala b/compiler/src/dotty/tools/repl/JLineTerminal.scala
index 22e44e4a5..9c33a7b87 100644
--- a/compiler/src/dotty/tools/repl/JLineTerminal.scala
+++ b/compiler/src/dotty/tools/repl/JLineTerminal.scala
@@ -17,9 +17,12 @@ final class JLineTerminal extends java.io.Closeable {
   // import java.util.logging.{Logger, Level}
   // Logger.getLogger("org.jline").setLevel(Level.FINEST)
 
-  private val terminal = TerminalBuilder.builder()
-    .dumb(false) // fail early if not able to create a terminal
-    .build()
+  // private val terminal = TerminalBuilder.builder()
+  //   .dumb(false) // fail early if not able to create a terminal
+  //   .build()
+  import java.lang.System
+  private val terminal =
+    new org.jline.terminal.impl.DumbTerminal(System.in, System.out)
   private val history = new DefaultHistory
 
   private def blue(str: String) = Console.BLUE + str + Console.RESET

I would be Ok to make this configurable in order to use dumb terminal in tests. However, we clearly need to document what can be tested

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I just wanted to enable it as fallback if there is no alternative. Even a dumb REPL seems better than no REPL at all? Tho we should probably warn the user to fix their terminal.

Anyway, supporting dumb terminals for users is a separate question.

@@ -1,4 +1,3 @@
> run
> 'set initialCommands := "1 + 1" '
# FIXME: does not work on the CI
#> console
> console
Copy link
Contributor

Choose a reason for hiding this comment

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

A more extensive REPL test would be nice. I don't know to what extent we can test the REPL with scripted tests. E.g. can we test something like #3007?

Copy link
Contributor Author

@Blaisorblade Blaisorblade Aug 26, 2018

Choose a reason for hiding this comment

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

IIUC, this already tests that starting the console succeeds, which seems why @SzymonPajzert was interested for #4933.

If we want to connect something to the actual terminal, give commands and wait for responses, one could use expect-like programs.
If we bypass the terminal logic, it seems we'd have to add a consoleTest script command which combines console with ReplTest: it'd be a ConsoleInterface creating, instead of ReplDriver, a ScriptedTests on the script. EDIT: but that, and interfacing to sbt for that, seems much more than I plan for this PR or I can take on.

@SzymonPajzert
Copy link
Contributor

Hi, yes, that would be probably enough at the beginning, probably more tests will be added with resolution of #5069, but for now it seems sufficient for me.

@odersky
Copy link
Contributor

odersky commented Jan 12, 2019

@Blaisorblade Inactive for 4 months. What should we do with this?

@odersky
Copy link
Contributor

odersky commented Jan 12, 2019

/cc @allanrenucci We should reach a decision what to do with this.

@Blaisorblade
Copy link
Contributor Author

I'm afraid I won't get back to this one any time soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants