Fix circleci build test - outdated imports in test/maxgap.go.

merlin
cyoung 2017-09-22 11:20:15 -04:00
rodzic 7f6f1394e0
commit abe84edfae
3 zmienionych plików z 34 dodań i 33 usunięć

Wyświetl plik

@ -14,7 +14,7 @@ all:
make xdump978 xdump1090 xgen_gdl90 $(PLATFORMDEPENDENT) make xdump978 xdump1090 xgen_gdl90 $(PLATFORMDEPENDENT)
xgen_gdl90: xgen_gdl90:
go get -t -d -v ./main ./godump978 ./uatparse ./sensors go get -t -d -v ./main ./test ./godump978 ./uatparse ./sensors
go build $(BUILDINFO) -p 4 main/gen_gdl90.go main/traffic.go main/gps.go main/network.go main/managementinterface.go main/sdr.go main/ping.go main/uibroadcast.go main/monotonic.go main/datalog.go main/equations.go main/sensors.go main/cputemp.go go build $(BUILDINFO) -p 4 main/gen_gdl90.go main/traffic.go main/gps.go main/network.go main/managementinterface.go main/sdr.go main/ping.go main/uibroadcast.go main/monotonic.go main/datalog.go main/equations.go main/sensors.go main/cputemp.go
fancontrol: fancontrol:

Wyświetl plik

@ -9,6 +9,10 @@ dependencies:
override: override:
- cd .. ; rm -rf stratux ; git clone --recursive https://github.com/cyoung/stratux ; cd stratux ; git config --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pr/*" ; git fetch origin ; BRANCH=`echo "$CIRCLE_BRANCH" | sed 's/pull\//pr\//g'` ; git checkout $BRANCH ; make - cd .. ; rm -rf stratux ; git clone --recursive https://github.com/cyoung/stratux ; cd stratux ; git config --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pr/*" ; git fetch origin ; BRANCH=`echo "$CIRCLE_BRANCH" | sed 's/pull\//pr\//g'` ; git checkout $BRANCH ; make
test:
override:
- make test
deployment: deployment:
production: production:
branch: master branch: master

Wyświetl plik

@ -1,27 +1,25 @@
package main package main
import ( import (
"fmt" "fmt"
// "time" // "time"
"../uatparse" "../uatparse"
"os"
"bufio" "bufio"
"gonum.org/v1/plot"
"gonum.org/v1/plot/plotter"
"gonum.org/v1/plot/plotutil"
"gonum.org/v1/plot/vg"
"os"
"sort"
"strconv"
"strings" "strings"
"unicode" "unicode"
"strconv"
"github.com/gonum/plot"
"github.com/gonum/plot/plotter"
"github.com/gonum/plot/plotutil"
"github.com/gonum/plot/vg"
"sort"
) )
const ( const (
UPLINK_FRAME_DATA_BYTES = 432 UPLINK_FRAME_DATA_BYTES = 432
) )
/* /*
From AC 00-45G [http://www.faa.gov/documentLibrary/media/Advisory_Circular/AC_00-45G_CHG_1-2.pdf] From AC 00-45G [http://www.faa.gov/documentLibrary/media/Advisory_Circular/AC_00-45G_CHG_1-2.pdf]
@ -51,29 +49,28 @@ Winds Aloft 12 hours 10 minutes
*/ */
func append_metars(rawUplinkMessage string, curMetars []string) []string { func append_metars(rawUplinkMessage string, curMetars []string) []string {
ret := curMetars ret := curMetars
uatMsg, err := uatparse.New(rawUplinkMessage) uatMsg, err := uatparse.New(rawUplinkMessage)
if err != nil { if err != nil {
return ret return ret
} }
//fmt.Printf("*************************\n") //fmt.Printf("*************************\n")
metars, _ := uatMsg.GetTextReports() metars, _ := uatMsg.GetTextReports()
for _, v := range metars { for _, v := range metars {
//fmt.Printf("EE: %s\n", v) //fmt.Printf("EE: %s\n", v)
vSplit := strings.Split(v, " ") vSplit := strings.Split(v, " ")
if vSplit[0] != "METAR" || len(vSplit) < 3 { // Only looking for METARs. if vSplit[0] != "METAR" || len(vSplit) < 3 { // Only looking for METARs.
continue continue
} }
ret = append(ret, v) ret = append(ret, v)
} }
//fmt.Printf("=========================\n") //fmt.Printf("=========================\n")
return ret return ret
} }
/* /*
Average number of METARs received for an airport for which you first received a METAR in the first 5 minutes, over 10 minutes. Divided by two. Average number of METARs received for an airport for which you first received a METAR in the first 5 minutes, over 10 minutes. Divided by two.
*/ */
@ -97,7 +94,7 @@ func metar_qos_one_period(a, b []string) float64 {
ret += float64(num) ret += float64(num)
} }
if len(numMetarByIdent) > 0 { if len(numMetarByIdent) > 0 {
ret = ret / float64(2 * len(numMetarByIdent)) ret = ret / float64(2*len(numMetarByIdent))
} }
return ret return ret
} }
@ -124,7 +121,7 @@ func main() {
if err != nil { if err != nil {
break break
} }
buf = strings.TrimFunc(buf, func(r rune) bool {return unicode.IsControl(r)}) buf = strings.TrimFunc(buf, func(r rune) bool { return unicode.IsControl(r) })
linesplit := strings.Split(buf, ",") linesplit := strings.Split(buf, ",")
if len(linesplit) < 2 { // Blank line or invalid. if len(linesplit) < 2 { // Blank line or invalid.
continue continue
@ -132,9 +129,9 @@ func main() {
if linesplit[0] == "START" { // Reset ticker, new start. if linesplit[0] == "START" { // Reset ticker, new start.
//TODO: Support multiple sessions. //TODO: Support multiple sessions.
// Reset the counters, new session. // Reset the counters, new session.
// qos = make(map[uint]float64) // qos = make(map[uint]float64)
// curWindowMetars = make([]string, 0) // curWindowMetars = make([]string, 0)
// curWindow = 0 // curWindow = 0
windowOffset = curWindow windowOffset = curWindow
} else { // If it's not "START", then it's a tick count. } else { // If it's not "START", then it's a tick count.
i, err := strconv.ParseInt(linesplit[0], 10, 64) i, err := strconv.ParseInt(linesplit[0], 10, 64)
@ -145,17 +142,17 @@ func main() {
// Window number in current session. // Window number in current session.
wnum := int64(i / (5 * 60 * 1000000000)) wnum := int64(i / (5 * 60 * 1000000000))
// fmt.Printf("%d\n", curWindow) // fmt.Printf("%d\n", curWindow)
if wnum + windowOffset != curWindow { // Switched over. if wnum+windowOffset != curWindow { // Switched over.
curWindow = wnum + windowOffset curWindow = wnum + windowOffset
beforeLastWindowMetars, ok := metarsByWindow[curWindow - 2] beforeLastWindowMetars, ok := metarsByWindow[curWindow-2]
lastWindowMetars, ok2 := metarsByWindow[curWindow - 1] lastWindowMetars, ok2 := metarsByWindow[curWindow-1]
if ok && ok2 { if ok && ok2 {
// fmt.Printf("%v\n\n\nheyy\n\n%v\n", beforeLastWindowMetars, lastWindowMetars) // fmt.Printf("%v\n\n\nheyy\n\n%v\n", beforeLastWindowMetars, lastWindowMetars)
qos[curWindow - 1] = metar_qos_one_period(beforeLastWindowMetars, lastWindowMetars) qos[curWindow-1] = metar_qos_one_period(beforeLastWindowMetars, lastWindowMetars)
fmt.Printf("qos=%f\n", qos[curWindow - 1]) fmt.Printf("qos=%f\n", qos[curWindow-1])
delete(metarsByWindow, curWindow - 2) delete(metarsByWindow, curWindow-2)
delete(metarsByWindow, curWindow - 1) delete(metarsByWindow, curWindow-1)
} }
} }
metarsByWindow[curWindow] = append_metars(linesplit[1], metarsByWindow[curWindow]) metarsByWindow[curWindow] = append_metars(linesplit[1], metarsByWindow[curWindow])
@ -180,7 +177,7 @@ func main() {
pts := make(plotter.XYs, len(qos)) pts := make(plotter.XYs, len(qos))
i := 0 i := 0
for _,k := range keys { for _, k := range keys {
v := qos[int64(k)] v := qos[int64(k)]
fmt.Printf("%d, %f\n", k, v) fmt.Printf("%d, %f\n", k, v)
pts[i].X = float64(k) pts[i].X = float64(k)
@ -192,7 +189,7 @@ func main() {
if err != nil { if err != nil {
panic(err) panic(err)
} }
if err := p.Save(4 * vg.Inch, 4 * vg.Inch, "qos.png"); err != nil { if err := p.Save(4*vg.Inch, 4*vg.Inch, "qos.png"); err != nil {
panic(err) panic(err)
} }
} }