Skip to contentSkip to conversation

selftests/futex: Check ANSI terminal color support

PATCH In review SeongJae Park 3 participants 4 messages Oct 2, 2016 – Oct 11, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/futex: Check ANSI terminal color support

Because test for color support of the running shell does not aware ANSI type terminals, it does not print colorful messages on some environemnt. This commit modifies the test to aware ANSI type terminal, too.

---
 tools/testing/selftests/futex/functional/run.sh | 2 +-
 tools/testing/selftests/futex/run.sh            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/futex/functional/run.sh +1 -1
index e87dbe2a0b0d..7ff002eed624 100755
@@ -24,7 +24,7 @@
 
 # Test for a color capable console
 if [ -z "$USE_COLOR" ]; then
-    tput setf 7
+    tput setf 7 || tput setaf 7
     if [ $? -eq 0 ]; then
         USE_COLOR=1
         tput sgr0
tools/testing/selftests/futex/run.sh +1 -1
index 4126312ad64e..88bcb1767362 100755
@@ -23,7 +23,7 @@
 
 # Test for a color capable shell and pass the result to the subdir scripts
 USE_COLOR=0
-tput setf 7
+tput setf 7 || tput setaf 7
 if [ $? -eq 0 ]; then
     USE_COLOR=1
     tput sgr0
Signature · 1 line
2.10.0
reviewer Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · SeongJae Park

Because test for color support of the running shell does not aware ANSI type terminals, it does not print colorful messages on some environemnt. This commit modifies the test to aware ANSI type terminal, too.

No objection. Terminfo slists these separately, and I don't see a way to handle ANSI in a single command.

Quoted 35 lines
---
 tools/testing/selftests/futex/functional/run.sh | 2 +-
 tools/testing/selftests/futex/run.sh            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/futex/functional/run.sh +1 -1
index e87dbe2a0b0d..7ff002eed624 100755
@@ -24,7 +24,7 @@
 
 # Test for a color capable console
 if [ -z "$USE_COLOR" ]; then
-    tput setf 7
+    tput setf 7 || tput setaf 7
     if [ $? -eq 0 ]; then
         USE_COLOR=1
         tput sgr0
tools/testing/selftests/futex/run.sh +1 -1
index 4126312ad64e..88bcb1767362 100755
@@ -23,7 +23,7 @@
 
 # Test for a color capable shell and pass the result to the subdir scripts
 USE_COLOR=0
-tput setf 7
+tput setf 7 || tput setaf 7
 if [ $? -eq 0 ]; then
     USE_COLOR=1
     tput sgr0
Signature · 1 line
2.10.0
Signature · 2 lines
Darren Hart
Intel Open Source Technology Center
#2 lore raw
In reply to SeongJae Park

Hi,

Shuah, may I ask your comment about this patch?

Thanks,
SeongJae Park

Quoted 39 lines · SeongJae Park

Because test for color support of the running shell does not aware ANSI type terminals, it does not print colorful messages on some environemnt. This commit modifies the test to aware ANSI type terminal, too.

---
 tools/testing/selftests/futex/functional/run.sh | 2 +-
 tools/testing/selftests/futex/run.sh            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/futex/functional/run.sh +1 -1
index e87dbe2a0b0d..7ff002eed624 100755
@@ -24,7 +24,7 @@
 
 # Test for a color capable console
 if [ -z "$USE_COLOR" ]; then
-    tput setf 7
+    tput setf 7 || tput setaf 7
     if [ $? -eq 0 ]; then
         USE_COLOR=1
         tput sgr0
tools/testing/selftests/futex/run.sh +1 -2
index 4126312ad64e..88bcb1767362 100755
@@ -23,7 +23,7 @@
 
 # Test for a color capable shell and pass the result to the subdir scripts
 USE_COLOR=0
-tput setf 7
+tput setf 7 || tput setaf 7
 if [ $? -eq 0 ]; then
     USE_COLOR=1
     tput sgr0
--

2.10.0

maintainer
#3 lore raw
Quoted 6 lines · SeongJae Park

Hi,

Shuah, may I ask your comment about this patch?

Looks good to me. I also see Daren's Ack. I will get this into 4.9-rc1.

thanks,
-- Shuah