Skip to content

Commit 7df46ee

Browse files
committed
Testsuite: T8602: stop "cat" abuse
Abusing cats is a prevalent problem in the Linux user community. Users, ranging from know-nothing neophytes to all-knowing professionals, engage in cat abuse on a daily basis, whether in their scripts or simple terminal commands. https://rseragon.github.io/posts/cat-abuse/
1 parent 097a04e commit 7df46ee

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

scripts/check-qemu-install

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,8 @@ def basic_cli_tests(c):
560560
c.expect(op_mode_prompt)
561561

562562
# Get serial console interface name from flavor definition
563-
c.sendline('cat /usr/share/vyos/flavor.json | jq -r ".console_type"')
563+
flavor_json = '/usr/share/vyos/flavor.json'
564+
c.sendline(f'jq -r ".console_type" {flavor_json}')
564565
c.expect(op_mode_prompt)
565566
lines = [l.strip() for l in c.before.splitlines() if l.strip()]
566567
console_type = lines[-1].decode('utf-8').strip() # e.g. ttyS
@@ -570,13 +571,13 @@ def basic_cli_tests(c):
570571
if console_type == 'tty':
571572
return
572573

573-
c.sendline('cat /usr/share/vyos/flavor.json | jq -r ".console_num"')
574+
c.sendline(f'jq -r ".console_num" {flavor_json}')
574575
c.expect(op_mode_prompt)
575576
lines = [l.strip() for l in c.before.splitlines() if l.strip()]
576577
console_num = lines[-1].decode('utf-8').strip() # e.g. 0
577578

578579
# Get serial console speed from flavor definition
579-
c.sendline('cat /usr/share/vyos/flavor.json | jq -r ".console_speed"')
580+
c.sendline(f'jq -r ".console_speed" {flavor_json}')
580581
c.expect(op_mode_prompt)
581582
lines = [l.strip() for l in c.before.splitlines() if l.strip()]
582583
console_speed = lines[-1].decode('utf-8').strip() # e.g. 115200

0 commit comments

Comments
 (0)