Paste #277531

   
pasted on 26.09.2024 11:52
  • Edit to this paste
  • Print
  • Raw
  • Compare with paste
    #  
  • Toggle line numbers
  • Syntax highlighting  
Text paste
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash

PROGRAM_PATH="/home/user/sertst"
export PATH="${PATH}:${PROGRAM_PATH}"

function loop(){

declare -i port=0
declare -r log_prefix="${PROGRAM_PATH}/log/com"
declare -r postfix=$$
declare -a logs


for index in ${window[@]};do

    command="serialtest_5Loopback -t 5 -c /dev/ttyS$port -s7 -ml -f $log_prefix$((port+1))test.$postfix.log -n COM$((port+1)) -i 512"

logs+="$log_prefix$((port+1))test.$postfix.log "  # Формируем списко лог файлов, в которые записывается данные тестов


test $(exec $(which xterm) -T "SerialTest $index" -geometry $index -e $command) &

if [ $port -eq 3 ];then
        pid=$!
fi

#echo $command

let port++

done
wait $pid
echo ${logs[@]}
}

test_env(){
CDIR="${PROGRAM_PATH}/log"
if [ ! -d $CDIR ];then
mkdir log
else
    echo "Log dir [OK] "
fi

}

# Собираем все логи в один файл.

function merge_logs(){
    echo "Start merge logs"
    filename=($@)
    for index in ${filename[@]}; do
        cat $index >> $CDIR/com-$(date +'%F-%H-%M').log
    done
}

function master(){
    declare -a window=("50x10+1080+0" "50x10+1080+175" "50x10+610+0" "50x10+610+175")
    test_env
   declare -a res=$(loop ${window[@]})
    merge_logs $res
}

master
Add Comment
Author