You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2026/09/03 16:49:22 UTC
(groovy) branch master updated: Stabilize timer and control-character tests
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new cddcda6a31 Stabilize timer and control-character tests
cddcda6a31 is described below
commit cddcda6a31592f1f5b3d7add701a0a7c8ad4a412
Author: Daniel Sun <su...@apache.org>
AuthorDate: Fri Sep 4 01:43:38 2026 +0900
Stabilize timer and control-character tests
---
.../groovy/groovy/concurrent/ChannelSelectTest.groovy | 19 ++++++++++++++-----
.../groovysh/jline/GroovyPosixCommandsTest.groovy | 8 ++++++++
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/src/test/groovy/groovy/concurrent/ChannelSelectTest.groovy b/src/test/groovy/groovy/concurrent/ChannelSelectTest.groovy
index 05bee60c7a..56f752ac2a 100644
--- a/src/test/groovy/groovy/concurrent/ChannelSelectTest.groovy
+++ b/src/test/groovy/groovy/concurrent/ChannelSelectTest.groovy
@@ -1314,18 +1314,27 @@ final class ChannelSelectTest {
void testTimerOfferReArmsOnEveryRound() {
assertScript '''
import groovy.concurrent.AsyncChannel
+ import java.util.concurrent.SynchronousQueue
import static groovy.concurrent.ChannelSelect.*
def work = AsyncChannel.create()
- def sel = offers(receive(work), after(150))
+ def sel = offers(receive(work), after(300))
+ def rounds = new SynchronousQueue()
- // each round's value arrives well inside the round's own deadline
- // but well past the first round's: a fixed deadline would time out
+ // Signal the sender only after select has armed its branches. Each
+ // value is well within its own deadline but all four exceed a
+ // single fixed deadline started before the first round.
async {
- for (i in 0..<4) { Thread.sleep(60); work.send(i) }
+ for (i in 0..<4) {
+ rounds.take()
+ Thread.sleep(100)
+ work.send(i)
+ }
}
def received = (0..<4).collect {
- def result = await sel.select()
+ def pending = sel.select()
+ rounds.put(it)
+ def result = await pending
assert !result.timeout && result.channel.is(work)
result.value
}
diff --git a/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/jline/GroovyPosixCommandsTest.groovy b/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/jline/GroovyPosixCommandsTest.groovy
index c7c59e169c..6a91f2065c 100644
--- a/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/jline/GroovyPosixCommandsTest.groovy
+++ b/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/jline/GroovyPosixCommandsTest.groovy
@@ -29,6 +29,8 @@ import java.nio.file.Files
import java.nio.file.Path
import java.util.function.Function
+import static org.junit.jupiter.api.Assumptions.assumeFalse
+
/**
* Direct unit tests for static methods in {@link GroovyPosixCommands} — the
* Apache-licensed fork of JLine's PosixCommands. Bypasses the registry stack
@@ -94,6 +96,8 @@ class GroovyPosixCommandsTest {
// GROOVY-12341
@Test
void lsStripsControlCharactersFromFileNames() {
+ assumeFalse(System.getProperty('os.name').containsIgnoreCase('windows'),
+ 'Windows file names cannot contain control characters')
Files.writeString(tempDir.resolve(HOSTILE_NAME), 'x\n')
GroovyPosixCommands.ls(context(), ['/ls'] as Object[])
def output = stdout()
@@ -105,6 +109,8 @@ class GroovyPosixCommandsTest {
// GROOVY-12341
@Test
void lsStripsControlCharactersFromSymlinkTargets() {
+ assumeFalse(System.getProperty('os.name').containsIgnoreCase('windows'),
+ 'Windows file names cannot contain control characters')
Path target = Files.writeString(tempDir.resolve(HOSTILE_NAME), 'x\n')
try {
Files.createSymbolicLink(tempDir.resolve('link.txt'), target)
@@ -119,6 +125,8 @@ class GroovyPosixCommandsTest {
// GROOVY-12341
@Test
void headAndGrepAndWcStripControlCharactersFromNames() {
+ assumeFalse(System.getProperty('os.name').containsIgnoreCase('windows'),
+ 'Windows file names cannot contain control characters')
// the same treatment upstream applies to every command that echoes a source name
Path file = Files.writeString(tempDir.resolve(HOSTILE_NAME), 'alpha\nbeta\n')
Path plain = Files.writeString(tempDir.resolve('plain.txt'), 'alpha\n')