Date:2011-04-20 06:29:11 (8 years 4 months ago)
Author:Werner Almesberger
Commit:04db5e0418399bd7d3fb74fffb5877ab8ebfc436
Message:prod/: some elements of a production test system (in progress)

Files: prod/Common (1 diff)
prod/atben (1 diff)

Change Details

prod/Common
1#!/bin/sh
2
3DIV1=------------------------------------------------------------------------
4DIV2=========================================================================
5
6
7usage()
8{
9    echo "usage: $0 ref_dev test_dev" 1>&2
10    exit 1
11}
12
13
14[ "$2" -a -z "$3" ] || usage
15REF=$1
16# DUT = Device Under Test
17DUT=$2
18LOG=_log
19>$LOG
20
21if [ ${DUT#net:} = $DUT ]; then
22    LOCAL_EXEC=
23    LOCAL_DUT=$DUT
24else
25    LOCAL_EXEC="ssh `echo $DUT | sed 's/^net://;s/,.*$//'`"
26    LOCAL_DUT=default
27fi
28
29step()
30{
31    echo -n " .... $1"
32    step=$1
33    cmd=
34    >_out
35    echo $DIV2 >>$LOG
36}
37
38
39finish()
40{
41    echo "$cmd" >>$LOG
42    echo | sed "c$DIV1" >>$LOG
43    cat _out >>$LOG
44    sed "1i$DIV1" >>$LOG
45}
46
47
48pass()
49{
50    echo '\r\033[42;30m PASS \033[0m '
51    echo "$step: PASS" >>$LOG
52    finish </dev/null
53}
54
55
56fail()
57{
58    echo '\r\033[41;37m FAIL \033[0m '
59    echo "$step: FAIL" >>$LOG
60    finish
61#
62# to do: allow looping back
63#
64    exit 1
65}
66
67
68todo()
69{
70    echo '\r\033[43;30m TODO \033[0m '
71    echo "$step: TODO" >>$LOG
72    finish </dev/null
73}
74
75
76cmd()
77{
78    cmd=$1
79}
80
81
82expect()
83{
84    eval "$cmd" >_out 2>&1 || { echo "exit code $?" | fail; exit 1; }
85    fgrep -q "$1" _out || { echo "expected $1" | fail; exit 1; }
86    pass
87}
88
89
90expect_re()
91{
92    eval "$cmd" >_out 2>&1 || { echo "exit code $?" | fail; exit 1; }
93    grep -q "$1" _out || { echo "expected $1" | fail; exit 1; }
94    pass
95}
96
97
98identify()
99{
100    step "Identification"
101    cmd "atrf-id -d $DUT"
102    expect "AT86RF231, part 0x03 version 2 manufacturer xxxx001f (Atmel)"
103}
104
105
106spectrum()
107{
108    step "Spectrum"
109# todo:
110# - trim values (maybe)
111# - profile
112# - decide on power
113# - decide on offset
114    cmd "atrf-path -g -T +0.5 $REF $DUT 10"
115    expect PASS
116}
117
118
119transmit()
120{
121    step "Receive"
122# todo:
123# - trim values (maybe)
124# - channel
125# - tolerate imperfection (e.g., 99/100|100/100)
126    cmd "atrf-xmit -p 0 $REF $DUT 100"
127    expect 100/100
128
129    step "Send"
130    cmd "atrf-xmit -p 15 $DUT $REF 100"
131    expect 100/100
132}
prod/atben
1#!/bin/sh
2
3. ./Common
4
5
6gpio_ben()
7{
8    step "GPIO scan"
9    todo
10}
11
12
13xtal_ben()
14{
15    step "Crystal frequency"
16    cmd "$LOCAL_EXEC atrf-xtal -d $LOCAL_DUT 100"
17    expect_re '4350[012]\.' # @@@ very crude ...
18}
19
20
21identify
22# power ?
23gpio_ben
24xtal_ben
25spectrum
26transmit

Archive Download the corresponding diff file



interactive