Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pythia.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,23 @@

ENV_OUT_DIR := $(VM_OUT_DIR)

ENV_GO_DIR := $~/test
ENV_BIND_DIR := $(GO_DIR)/bin
ENV_GOPATH := "$(abspath $(ENV_GO_DIR)):$(abspath $(GO_DIR))"
ENV_GO := GOPATH=$(ENV_GOPATH) go

ENV_GO_PACKAGES := env_test

# The environments target is filled by the subdirectories
$(call add_target,environments,BUILD,Generate all environments)
all: environments
environments:

$(call include_subdirs, busybox python java mono c)

$(call add_target,envtest,MISC,Run environments tests)
check: envtest
envtest:
$(ENV_GO) test $(ENV_GO_PACKAGES)

# vim:set ts=4 sw=4 noet:
42 changes: 42 additions & 0 deletions test/src/env_test/env_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright 2013 The Pythia Authors.
// This file is part of Pythia.
//
// Pythia is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, version 3 of the License.
//
// Pythia is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Pythia. If not, see <http://www.gnu.org/licenses/>.

package env_test

import (
"io/ioutil"
"path"
"pythia"
"pythia/backend"
"strings"
"testing"
"testutils/pytest"
)

func TestEnvironments(t *testing.T) {
backend.Run(t, "hello-input", "me\npythia\n",
pythia.Success, "Hello me!\nHello pythia!\n")
taskfiles, _ := ioutil.ReadDir(pytest.TasksDir)
for _, f := range taskfiles {
if !f.IsDir() && path.Ext(f.Name()) == ".task" {
matched, _ := path.Match("test-*", f.Name())
if matched {
task := strings.TrimSuffix(f.Name(), path.Ext(f.Name()))
input := "Environment test: " + task
backend.Run(t, task, input, pythia.Success, input)
}
}
}
}