Skip to content

Commit

Permalink
Adding Vagrantbox for Solaris and FreeBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewkroh committed Jan 23, 2016
1 parent e266261 commit c51201a
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 24 deletions.
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ PROJECTS=libbeat ${BEATS}
# Runs complete testsuites (unit, system, integration) for all beats,
# with coverage and race detection.
testsuite:
$(foreach var,$(PROJECTS),make -C $(var) testsuite || exit 1;)
$(foreach var,$(PROJECTS),$(MAKE) -C $(var) testsuite || exit 1;)

# Runs unit and system tests without coverage and race detection.
.PHONY: test
test:
$(foreach var,$(PROJECTS),make -C $(var) test || exit 1;)
$(foreach var,$(PROJECTS),$(MAKE) -C $(var) test || exit 1;)

# Runs unit tests without coverage and race detection.
.PHONY: unit
unit:
$(foreach var,$(PROJECTS),make -C $(var) unit || exit 1;)
$(foreach var,$(PROJECTS),$(MAKE) -C $(var) unit || exit 1;)

.PHONY: coverage-report
coverage-report:
Expand All @@ -32,16 +32,16 @@ coverage-report:
go tool cover -html=./${COVERAGE_DIR}/full.cov -o ${COVERAGE_DIR}/full.html

update:
$(foreach var,$(BEATS),make -C $(var) update || exit 1;)
$(foreach var,$(BEATS),$(MAKE) -C $(var) update || exit 1;)

clean:
$(foreach var,$(PROJECTS),make -C $(var) clean || exit 1;)
$(foreach var,$(PROJECTS),$(MAKE) -C $(var) clean || exit 1;)

check:
$(foreach var,$(PROJECTS),make -C $(var) check || exit 1;)
$(foreach var,$(PROJECTS),$(MAKE) -C $(var) check || exit 1;)

fmt:
$(foreach var,$(PROJECTS),make -C $(var) fmt || exit 1;)
$(foreach var,$(PROJECTS),$(MAKE) -C $(var) fmt || exit 1;)

simplify:
$(foreach var,$(PROJECTS),make -C $(var) simplify || exit 1;)
$(foreach var,$(PROJECTS),$(MAKE) -C $(var) simplify || exit 1;)
43 changes: 39 additions & 4 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@
# - There is a desktop shortcut labeled "Beats Shell" that opens a command prompt
# to C:\Gopath\src\github.com\elastic\beats where the code is mounted.
#
# add more boxes here
# solaris
# -------------------
# More development boxes can be added to this file and you can run commands
# like "vagrant up solaris" or "vagrant up winxp" to start them.
# - Use gmake instead of make.
#
# freebsd
# -------------------
# - Use gmake instead of make.
# - Folder syncing doesn't work well. Consider copying the files into the box or
# cloning the project inside the box.

# Provisioning for Windows PowerShell
$winPsProvision = <<SCRIPT
Expand All @@ -41,10 +46,19 @@ $AUSettigns.NotificationLevel = 1
$AUSettigns.Save()
SCRIPT

# Provisioning for Unix/Linux
$unixProvision = <<SCRIPT
echo 'Creating github.com/elastic in the GOPATH'
mkdir -p ~/go/src/github.com/elastic
echo 'Symlinking /vagrant to ~/go/src/github.com/elastic'
cd ~/go/src/github.com/elastic
if [ -d "/vagrant" ]; then ln -s /vagrant beats; fi
SCRIPT

Vagrant.configure(2) do |config|

# Windows Server 2012 R2
config.vm.define "win2012", primary: true do |win2012|
# Windows Server 2012 R2
win2012.vm.box = "https://s3.amazonaws.com/beats-files/vagrant/beats-win2012-r2-virtualbox-2016-01-20_0057.box"
win2012.vm.guest = :windows

Expand All @@ -59,6 +73,27 @@ Vagrant.configure(2) do |config|
win2012.vm.provision "shell", inline: $winPsProvision
end

# Solaris 11.2
config.vm.define "solaris", primary: true do |solaris|
solaris.vm.box = "https://s3.amazonaws.com/beats-files/vagrant/beats-solaris-11.2-virtualbox-2016-01-23_0522.box"
solaris.vm.network :forwarded_port, guest: 22, host: 2223, id: "ssh", auto_correct: true

solaris.vm.provision "shell", inline: $unixProvision, privileged: false
end

# FreeBSD 11.0
config.vm.define "freebsd", primary: true do |freebsd|
freebsd.vm.box = "https://s3.amazonaws.com/beats-files/vagrant/beats-freebsd-11.0-virtualbox-2016-01-23_1919.box"
freebsd.vm.network :forwarded_port, guest: 22, host: 2224, id: "ssh", auto_correct: true

# Must use NFS to sync a folder on FreeBSD and this requires a host-only network.
# To enable the /vagrant folder, set disabled to false and uncomment the private_network.
config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", :nfs => true, disabled: true
#config.vm.network "private_network", ip: "192.168.135.18"

freebsd.vm.provision "shell", inline: $unixProvision, privileged: false
end

end

# -*- mode: ruby -*-
Expand Down
24 changes: 12 additions & 12 deletions libbeat/scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export PATH := ./bin:$(PATH)
export GO15VENDOREXPERIMENT=1
GOFILES = $(shell find . -type f -name '*.go')
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
SHELL=/bin/bash
SHELL=bash
ES_HOST?="elasticsearch"
BUILD_DIR?=build
COVERAGE_DIR=${BUILD_DIR}/coverage
Expand Down Expand Up @@ -88,9 +88,9 @@ clean:
# This should always run before merging.
.PHONY: ci
ci:
make
make check
make testsuite
$(MAKE)
$(MAKE) check
$(MAKE) testsuite

### Testing ###
# Unless stated otherwise, all tests are always run with coverage reporting enabled.
Expand Down Expand Up @@ -124,8 +124,8 @@ integration-tests: prepare-tests
# Runs the integration inside a virtual environment. This can be run on any docker-machine (local, remote)
.PHONY: integration-tests-environment
integration-tests-environment:
make prepare-tests
make build-image
$(MAKE) prepare-tests
$(MAKE) build-image
NAME=$$(${DOCKER_COMPOSE} run -d beat make integration-tests | awk 'END{print}') || exit 1; \
echo "docker beat test container: '$$NAME'"; \
docker attach $$NAME; CODE=$$?;\
Expand Down Expand Up @@ -162,26 +162,26 @@ benchmark-tests:
.PHONY: test
test: unit
if [ $(SYSTEM_TESTS) = true ]; then \
make fast-system-tests; \
$(MAKE) fast-system-tests; \
fi

# Runs all tests and generates the coverage reports
.PHONY: testsuite
testsuite:
# Setups environment if TEST_ENVIRONMENT is set to true
if [ $(TEST_ENVIRONMENT) = true ]; then \
make integration-tests-environment; \
$(MAKE) integration-tests-environment; \
else \
make integration-tests; \
$(MAKE) integration-tests; \
fi

# Runs system tests if SYSTEM_TESTS is set to true
if [ $(SYSTEM_TESTS) = true ]; then \
make system-tests; \
$(MAKE) system-tests; \
fi

make benchmark-tests
make coverage-report
$(MAKE) benchmark-tests
$(MAKE) coverage-report

# Generates a coverage report from the existing coverage files
.PHONY: coverage-report
Expand Down

0 comments on commit c51201a

Please sign in to comment.