Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #692 from chavafg/topic/travis-add-os
Browse files Browse the repository at this point in the history
travis: add linux-ppc64le and osx
  • Loading branch information
GabyCT authored Sep 7, 2018
2 parents 669472a + 99e348d commit f8ebf60
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .ci/static-checks.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# Copyright (c) 2017-2018 Intel Corporation
#
Expand Down
21 changes: 18 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@
# SPDX-License-Identifier: Apache-2.0
#

dist: trusty
os:
- linux
- osx
- linux-ppc64le

matrix:
include:
- os: linux
sudo: required
dist: trusty

language: go
go_import_path: github.com/kata-containers/tests

go:
- "1.10.x"
Expand All @@ -15,5 +25,10 @@ go:
env:
- target_branch=$TRAVIS_BRANCH

before_script:
- ".ci/static-checks.sh github.com/kata-containers/tests"
before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update -qq ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y -qq automake ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install bash; fi

script:
- bash .ci/static-checks.sh github.com/kata-containers/tests
3 changes: 2 additions & 1 deletion cmd/log-parser/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ $(TARGET): $(SOURCES) check
go build -o "$(TARGET)" -ldflags "-X main.name=${TARGET} -X main.commit=${COMMIT} -X main.version=${VERSION}" .

install: $(TARGET)
install -D $(TARGET) $(DESTTARGET)
install -d $(shell dirname $(DESTTARGET))
install $(TARGET) $(DESTTARGET)

clean:
rm -f $(TARGET)
Expand Down
15 changes: 15 additions & 0 deletions integration/docker/kill_darwin_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (c) 2018 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0

package docker

import (
"syscall"

. "github.com/onsi/ginkgo/extensions/table"
)

func withOSSignals(signalsMap map[syscall.Signal]bool) []TableEntry {
return withGenericSignals(signalsMap)
}
16 changes: 16 additions & 0 deletions integration/docker/kill_linux_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) 2018 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0

package docker

import (
"syscall"

. "github.com/onsi/ginkgo/extensions/table"
)

func withOSSignals(signalsMap map[syscall.Signal]bool) []TableEntry {
signalsMap[syscall.SIGPWR] = canBeTrapped
return withGenericSignals(signalsMap)
}
81 changes: 43 additions & 38 deletions integration/docker/kill_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,32 @@ const (
canBeTrapped = true
)

func withSignal(signal syscall.Signal, trap bool) TableEntry {
expectedExitCode := int(signal)
if !trap {
// 128 -> command interrupted by a signal
// http://www.tldp.org/LDP/abs/html/exitcodes.html
expectedExitCode += 128
}

return Entry(fmt.Sprintf("with '%d'(%s) signal", signal, syscall.Signal(signal)), signal, expectedExitCode, true)
var genericSignalMap = map[syscall.Signal]bool{
syscall.SIGHUP: canBeTrapped,
syscall.SIGINT: canBeTrapped,
syscall.SIGQUIT: canBeTrapped,
syscall.SIGILL: canBeTrapped,
syscall.SIGTRAP: canBeTrapped,
syscall.SIGIOT: canBeTrapped,
syscall.SIGFPE: canBeTrapped,
syscall.SIGUSR1: canBeTrapped,
syscall.SIGSEGV: canBeTrapped,
syscall.SIGUSR2: canBeTrapped,
syscall.SIGPIPE: canBeTrapped,
syscall.SIGALRM: canBeTrapped,
syscall.SIGTERM: canBeTrapped,
syscall.SIGCHLD: canBeTrapped,
syscall.SIGCONT: canBeTrapped,
syscall.SIGTSTP: canBeTrapped,
syscall.SIGTTIN: canBeTrapped,
syscall.SIGTTOU: canBeTrapped,
syscall.SIGURG: canBeTrapped,
syscall.SIGXCPU: canBeTrapped,
syscall.SIGXFSZ: canBeTrapped,
syscall.SIGVTALRM: canBeTrapped,
syscall.SIGPROF: canBeTrapped,
syscall.SIGWINCH: canBeTrapped,
syscall.SIGIO: canBeTrapped,
}

func withoutSignal() TableEntry {
Expand All @@ -43,6 +60,22 @@ func withSignalNotExitCode(signal syscall.Signal) TableEntry {
return Entry(fmt.Sprintf("with '%d' (%s) signal, don't change the exit code", signal, signal), signal, 0, false)
}

func withGenericSignals(signalsMap map[syscall.Signal]bool) []TableEntry {
var table []TableEntry
var expectedExitCode int
for signal, trap := range signalsMap {
expectedExitCode = int(signal)
if !trap {
// 128 -> command interrupted by a signal
// http://www.tldp.org/LDP/abs/html/exitcodes.html
expectedExitCode += 128

}
table = append(table, Entry(fmt.Sprintf("with '%d'(%s) signal", int(signal), signal), signal, expectedExitCode, true))
}
return append(table, withoutSignal(), withSignalNotExitCode(syscall.SIGSTOP))
}

var _ = Describe("docker kill", func() {
var (
args []string
Expand Down Expand Up @@ -119,34 +152,6 @@ var _ = Describe("docker kill", func() {
Expect(err).ToNot(HaveOccurred())
Expect(exitCode).To(Equal(expectedExitCode))
},
withSignal(syscall.SIGHUP, canBeTrapped),
withSignal(syscall.SIGINT, canBeTrapped),
withSignal(syscall.SIGQUIT, canBeTrapped),
withSignal(syscall.SIGILL, canBeTrapped),
withSignal(syscall.SIGTRAP, canBeTrapped),
withSignal(syscall.SIGIOT, canBeTrapped),
withSignal(syscall.SIGFPE, canBeTrapped),
withSignal(syscall.SIGUSR1, canBeTrapped),
withSignal(syscall.SIGSEGV, canBeTrapped),
withSignal(syscall.SIGUSR2, canBeTrapped),
withSignal(syscall.SIGPIPE, canBeTrapped),
withSignal(syscall.SIGALRM, canBeTrapped),
withSignal(syscall.SIGTERM, canBeTrapped),
withSignal(syscall.SIGSTKFLT, canBeTrapped),
withSignal(syscall.SIGCHLD, canBeTrapped),
withSignal(syscall.SIGCONT, canBeTrapped),
withSignalNotExitCode(syscall.SIGSTOP),
withSignal(syscall.SIGTSTP, canBeTrapped),
withSignal(syscall.SIGTTIN, canBeTrapped),
withSignal(syscall.SIGTTOU, canBeTrapped),
withSignal(syscall.SIGURG, canBeTrapped),
withSignal(syscall.SIGXCPU, canBeTrapped),
withSignal(syscall.SIGXFSZ, canBeTrapped),
withSignal(syscall.SIGVTALRM, canBeTrapped),
withSignal(syscall.SIGPROF, canBeTrapped),
withSignal(syscall.SIGWINCH, canBeTrapped),
withSignal(syscall.SIGIO, canBeTrapped),
withSignal(syscall.SIGPWR, canBeTrapped),
withoutSignal(),
withOSSignals(genericSignalMap)...,
)
})

0 comments on commit f8ebf60

Please sign in to comment.