cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

test_lirc_mode2.sh (764B)


      1#!/bin/bash
      2# SPDX-License-Identifier: GPL-2.0
      3
      4# Kselftest framework requirement - SKIP code is 4.
      5ksft_skip=4
      6ret=$ksft_skip
      7
      8msg="skip all tests:"
      9if [ $UID != 0 ]; then
     10	echo $msg please run this as root >&2
     11	exit $ksft_skip
     12fi
     13
     14GREEN='\033[0;92m'
     15RED='\033[0;31m'
     16NC='\033[0m' # No Color
     17
     18modprobe rc-loopback
     19
     20for i in /sys/class/rc/rc*
     21do
     22	if grep -q DRV_NAME=rc-loopback $i/uevent
     23	then
     24		LIRCDEV=$(grep DEVNAME= $i/lirc*/uevent | sed sQDEVNAME=Q/dev/Q)
     25		INPUTDEV=$(grep DEVNAME= $i/input*/event*/uevent | sed sQDEVNAME=Q/dev/Q)
     26	fi
     27done
     28
     29if [ -n "$LIRCDEV" ];
     30then
     31	TYPE=lirc_mode2
     32	./test_lirc_mode2_user $LIRCDEV $INPUTDEV
     33	ret=$?
     34	if [ $ret -ne 0 ]; then
     35		echo -e ${RED}"FAIL: $TYPE"${NC}
     36	else
     37		echo -e ${GREEN}"PASS: $TYPE"${NC}
     38	fi
     39fi
     40
     41exit $ret