Projects STRLCPY criu Commits 34e2b022
🤬
  • Optimized shell code with <'s (instead of cat + |)

    This patch optimizes shell code as reading a single file as input using a 'cat' command to a program.
    
    It is considered to be a Useless Use of Cat (UUOC).
    
    It's more efficient to simply use redirection.
    
    However, in some cases, even using the redirection operator '<' seems unnecessary.
    
    Signed-off-by: KKrypt <[email protected]>
  • Loading...
  • KKrypt committed with Andrei Vagin 1 year ago
    34e2b022
    1 parent 7cae16e9
  • ■ ■ ■ ■
    test/jenkins/criu-fault.sh
    skipped 8 lines
    9 9  ./test/zdtm.py run -t zdtm/static/maps00 --fault 3 --report report -f h || fail
    10 10   
    11 11  # FIXME: fhandles looks broken on btrfs
    12  -cat /proc/self/mountinfo | grep -P "/.* / " | grep -q btrfs || NOBTRFS=$?
     12 +grep -P "/.* / " /proc/self/mountinfo | grep -q btrfs || NOBTRFS=$?
    13 13  if [ $NOBTRFS -eq 1 ] ; then
    14 14   ./test/zdtm.py run -t zdtm/static/inotify_irmap --fault 128 --pre 2 -f uns || fail
    15 15  fi
    skipped 27 lines
  • ■ ■ ■ ■
    test/others/mem-snap/run-predump-2.sh
    skipped 27 lines
    28 28   wtime=1
    29 29   cd ../../zdtm/static/
    30 30   make maps04.stop
    31  - cat maps04.out | fgrep PASS || fail "Test failed"
     31 + fgrep PASS maps04.out || fail "Test failed"
    32 32   echo "OK"
    33 33  }
    34 34   
    skipped 33 lines
  • ■ ■ ■ ■
    test/others/mem-snap/run-predump.sh
    skipped 71 lines
    72 72   
    73 73  cd ../../zdtm/static/
    74 74  make mem-touch.stop
    75  -cat mem-touch.out | fgrep PASS || fail "Test failed"
     75 +fgrep PASS mem-touch.out || fail "Test failed"
    76 76   
    77 77  echo "Test PASSED"
    78 78   
  • ■ ■ ■ ■
    test/others/mem-snap/run-snap-auto-dedup.sh
    skipped 83 lines
    84 84   
    85 85  cd ../../zdtm/static/
    86 86  make mem-touch.stop
    87  -cat mem-touch.out | fgrep PASS || fail "Test failed"
     87 +fgrep PASS mem-touch.out || fail "Test failed"
    88 88   
    89 89  if [[ $dedup_ok_2 -ne 0 || $dedup_ok_1 -ne 0 ]]; then
    90 90   fail "Dedup test failed"
    skipped 4 lines
  • ■ ■ ■ ■
    test/others/mem-snap/run-snap-dedup-on-restore.sh
    skipped 77 lines
    78 78   
    79 79  cd ../../zdtm/static/
    80 80  make mem-touch.stop
    81  -cat mem-touch.out | fgrep PASS || fail "Test failed"
     81 +fgrep PASS mem-touch.out || fail "Test failed"
    82 82   
    83 83  if [ $restore_dedup_ok -ne 0 ]; then
    84 84   fail "Dedup test failed"
    skipped 4 lines
  • ■ ■ ■ ■
    test/others/mem-snap/run-snap-dedup.sh
    skipped 89 lines
    90 90   
    91 91  cd ../../zdtm/static/
    92 92  make mem-touch.stop
    93  -cat mem-touch.out | fgrep PASS || fail "Test failed"
     93 +fgrep PASS mem-touch.out || fail "Test failed"
    94 94   
    95 95  if [[ $dedup_ok_2 -ne 0 || $dedup_ok_1 -ne 0 ]]; then
    96 96   fail "Dedup test failed"
    skipped 4 lines
  • ■ ■ ■ ■
    test/others/mem-snap/run-snap-maps04.sh
    skipped 57 lines
    58 58  make -C ../../zdtm/static/ maps04.stop
    59 59  sleep 1
    60 60   
    61  -cat "../zdtm/static/maps04.out" | fgrep PASS || fail "Test failed"
     61 +fgrep PASS "../zdtm/static/maps04.out" || fail "Test failed"
    62 62   
    63 63  size=$(du -sh -BK dump/1/pages-*.img | grep -Eo '[0-9]+' | head -1)
    64 64  if [ $size -ne 0 ] ; then
    skipped 5 lines
  • ■ ■ ■ ■
    test/others/mem-snap/run-snap.sh
    skipped 68 lines
    69 69   
    70 70  cd ../../zdtm/static/
    71 71  make mem-touch.stop
    72  -cat mem-touch.out | fgrep PASS || fail "Test failed"
     72 +fgrep PASS mem-touch.out || fail "Test failed"
    73 73   
    74 74  echo "Test PASSED"
    75 75   
  • ■ ■ ■ ■
    test/others/mounts/mounts.sh
    skipped 11 lines
    12 12   
    13 13  mount --make-rprivate /
    14 14   
    15  -for i in `cat /proc/self/mounts | awk '{ print $2 }'`; do
     15 +for i in `awk '{ print $2 }' < /proc/self/mounts`; do
    16 16   [ '/' = "$i" ] && continue
    17 17   [ '/proc' = "$i" ] && continue
    18 18   [ '/dev' = "$i" ] && continue
    skipped 10 lines
  • ■ ■ ■ ■ ■ ■
    test/others/mounts/run.sh
    skipped 11 lines
    12 12  cat /proc/$pid/mountinfo | sort -k 4
    13 13  echo "Suspend server"
    14 14  ${CRIU} dump -D dump -o dump.log -t $pid -v4 || {
    15  - cat dump/dump.log | grep Error
     15 + grep Error dump/dump.log
    16 16   exit 1
    17 17  }
    18 18  echo "Resume server"
    19 19  ${CRIU} restore -d -D dump -o restore.log -v4 || {
    20  - cat dump/dump.log | grep Error
     20 + grep Error dump/dump.log
    21 21   exit 1
    22 22  }
    23 23  cat /proc/$pid/mountinfo | sort -k 4
    skipped 2 lines
  • ■ ■ ■ ■ ■ ■
    test/others/ns_ext/run.sh
    skipped 60 lines
    61 61  exec 34< $MNT2
    62 62  $CRIU dump -v4 -t $pid -o dump.log -D images --external $NS[$ino]:test_ns --external $NS[$ino2]:test_ns2
    63 63  RESULT=$?
    64  -cat images/dump.log | grep -B 5 Error || echo ok
     64 +grep -B 5 Error images/dump.log || echo ok
    65 65  [ "$RESULT" != "0" ] && {
    66 66   echo "CRIU dump failed"
    67 67   echo FAIL
    skipped 2 lines
    70 70   
    71 71  $CRIU restore -v4 -o restore.log -D images --inherit-fd fd[33]:test_ns --inherit-fd fd[34]:test_ns2 -d
    72 72  RESULT=$?
    73  -cat images/restore.log | grep -B 5 Error || echo ok
     73 +grep -B 5 Error images/restore.log || echo ok
    74 74  [ "$RESULT" != "0" ] && {
    75 75   echo "CRIU restore failed"
    76 76   echo FAIL
    skipped 21 lines
  • ■ ■ ■ ■ ■ ■
    test/others/ns_ext/run_pidns.sh
    skipped 35 lines
    36 36  echo "$CRIU dump -v4 -o dump.log -t $PID -D images_pidns --external $PIDNS:exti"
    37 37  $CRIU dump -v4 -o dump.log -t $PID -D images_pidns --external $PIDNS:exti
    38 38  RESULT=$?
    39  -cat images_pidns/dump.log | grep -B 5 Error || echo ok
     39 +grep -B 5 Error images_pidns/dump.log || echo ok
    40 40  [ "$RESULT" != "0" ] && {
    41 41   echo "CRIU dump failed"
    42 42   echo FAIL
    skipped 5 lines
    48 48  echo "$CRIU restore -v4 -o restore.log -D images_pidns --restore-detached --inherit-fd fd[$pidns_fd]:exti"
    49 49  $CRIU restore -v4 -o restore.log -D images_pidns --restore-detached --inherit-fd fd[$pidns_fd]:exti --pidfile test.pidfile
    50 50  RESULT=$?
    51  -cat images_pidns/restore.log | grep -B 5 Error || echo ok
     51 +grep -B 5 Error images_pidns/restore.log || echo ok
    52 52  [ "$RESULT" != "0" ] && {
    53 53   echo "CRIU restore failed"
    54 54   echo FAIL
    skipped 9 lines
  • ■ ■ ■ ■
    test/others/unix-callback/run.sh
    skipped 39 lines
    40 40  ${CRIU} restore -D data -o restore.log -v4 --lib `pwd`/lib -d || exit 1
    41 41  kill $pid
    42 42  while :; do
    43  - cat output | grep PASS && break
     43 + grep PASS output && break
    44 44   sleep 1
    45 45  done
    46 46   
    skipped 3 lines
Please wait...
Page is in error, reload to recover