Browse Source

Refactor tons of tests to use "run-in-container.sh" helper so we can handle most of the bind mount issues in a single script

Tianon Gravi 10 years ago
parent
commit
e1c676cdab

+ 0 - 0
test/tests/gcc-c-hello-world/hello-world.c → test/tests/gcc-c-hello-world/container.c


+ 0 - 8
test/tests/gcc-c-hello-world/run.sh

@@ -1,8 +0,0 @@
-#!/bin/bash
-set -e
-
-image="$1"
-dirTest="$(dirname "$(readlink -f "$BASH_SOURCE")")"
-dirContainer='/usr/src/c'
-
-docker run --rm -v "$dirTest":"$dirContainer":ro -w "$dirContainer" "$image" sh -c 'gcc -o /hello-world hello-world.c && /hello-world'

+ 1 - 0
test/tests/gcc-c-hello-world/run.sh

@@ -0,0 +1 @@
+../run-gcc-in-container.sh

+ 0 - 0
test/tests/gcc-cpp-hello-world/hello-world.cpp → test/tests/gcc-cpp-hello-world/container.cpp


+ 0 - 8
test/tests/gcc-cpp-hello-world/run.sh

@@ -1,8 +0,0 @@
-#!/bin/bash
-set -e
-
-image="$1"
-dirTest="$(dirname "$(readlink -f "$BASH_SOURCE")")"
-dirContainer='/usr/src/cpp'
-
-docker run --rm -v "$dirTest":"$dirContainer":ro -w "$dirContainer" "$image" sh -c 'g++ -o /hello-world hello-world.cpp && /hello-world'

+ 1 - 0
test/tests/gcc-cpp-hello-world/run.sh

@@ -0,0 +1 @@
+../run-g++-in-container.sh

+ 0 - 0
test/tests/golang-hello-world/hello-world.go → test/tests/golang-hello-world/container.go


+ 0 - 8
test/tests/golang-hello-world/run.sh

@@ -1,8 +0,0 @@
-#!/bin/bash
-set -e
-
-image="$1"
-dirTest="$(dirname "$(readlink -f "$BASH_SOURCE")")"
-dirContainer='/usr/src/hello-world'
-
-docker run --rm -v "$dirTest":"$dirContainer":ro -w "$dirContainer" "$image" go run hello-world.go

+ 1 - 0
test/tests/golang-hello-world/run.sh

@@ -0,0 +1 @@
+../run-go-in-container.sh

+ 0 - 0
test/tests/hylang-hello-world/hello-world.hy → test/tests/hylang-hello-world/container.hy


+ 0 - 8
test/tests/hylang-hello-world/run.sh

@@ -1,8 +0,0 @@
-#!/bin/bash
-set -e
-
-image="$1"
-dirTest="$(dirname "$(readlink -f "$BASH_SOURCE")")"
-dirContainer='/usr/src/hy'
-
-docker run --rm -v "$dirTest":"$dirContainer":ro -w "$dirContainer" "$image" hy hello-world.hy

+ 1 - 0
test/tests/hylang-hello-world/run.sh

@@ -0,0 +1 @@
+../run-hy-in-container.sh

+ 0 - 0
test/tests/julia-hello-world/hello-world.jl → test/tests/julia-hello-world/container.jl


+ 0 - 8
test/tests/julia-hello-world/run.sh

@@ -1,8 +0,0 @@
-#!/bin/bash
-set -e
-
-image="$1"
-dirTest="$(dirname "$(readlink -f "$BASH_SOURCE")")"
-dirContainer='/usr/src/julia'
-
-docker run --rm -v "$dirTest":"$dirContainer":ro -w "$dirContainer" "$image" julia hello-world.jl

+ 1 - 0
test/tests/julia-hello-world/run.sh

@@ -0,0 +1 @@
+../run-julia-in-container.sh

+ 0 - 0
test/tests/node-hello-world/hello-world.js → test/tests/node-hello-world/container.js


+ 0 - 8
test/tests/node-hello-world/run.sh

@@ -1,8 +0,0 @@
-#!/bin/bash
-set -e
-
-image="$1"
-dirTest="$(dirname "$(readlink -f "$BASH_SOURCE")")"
-dirContainer='/usr/src/node'
-
-docker run --rm -v "$dirTest":"$dirContainer":ro -w "$dirContainer" "$image" node hello-world.js

+ 1 - 0
test/tests/node-hello-world/run.sh

@@ -0,0 +1 @@
+../run-node-in-container.sh

+ 0 - 0
test/tests/perl-hello-world/hello-world.pl → test/tests/perl-hello-world/container.pl


+ 0 - 8
test/tests/perl-hello-world/run.sh

@@ -1,8 +0,0 @@
-#!/bin/bash
-set -e
-
-image="$1"
-dirTest="$(dirname "$(readlink -f "$BASH_SOURCE")")"
-dirContainer='/usr/src/perl'
-
-docker run --rm -v "$dirTest":"$dirContainer":ro -w "$dirContainer" "$image" perl hello-world.pl

+ 1 - 0
test/tests/perl-hello-world/run.sh

@@ -0,0 +1 @@
+../run-perl-in-container.sh

+ 0 - 0
test/tests/php-hello-world/index.php → test/tests/php-hello-world/container.php


+ 0 - 8
test/tests/php-hello-world/run.sh

@@ -1,8 +0,0 @@
-#!/bin/bash
-set -e
-
-image="$1"
-dirTest="$(dirname "$(readlink -f "$BASH_SOURCE")")"
-dirContainer='/var/www/html/hello-world'
-
-docker run --rm -v "$dirTest":"$dirContainer":ro -w "$dirContainer" "$image" php index.php

+ 1 - 0
test/tests/php-hello-world/run.sh

@@ -0,0 +1 @@
+../run-php-in-container.sh

+ 7 - 0
test/tests/run-g++-in-container.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+set -e
+
+testDir="$(readlink -f "$(dirname "$BASH_SOURCE")")"
+runDir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
+
+source "$runDir/run-in-container.sh" "$testDir" "$1" sh -c 'g++ -o /container ./container.cpp && exec /container'

+ 7 - 0
test/tests/run-gcc-in-container.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+set -e
+
+testDir="$(readlink -f "$(dirname "$BASH_SOURCE")")"
+runDir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
+
+source "$runDir/run-in-container.sh" "$testDir" "$1" sh -c 'gcc -o /container ./container.c && exec /container'

+ 7 - 0
test/tests/run-go-in-container.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+set -e
+
+testDir="$(readlink -f "$(dirname "$BASH_SOURCE")")"
+runDir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
+
+source "$runDir/run-in-container.sh" "$testDir" "$1" go run ./container.go

+ 7 - 0
test/tests/run-julia-in-container.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+set -e
+
+testDir="$(readlink -f "$(dirname "$BASH_SOURCE")")"
+runDir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
+
+source "$runDir/run-in-container.sh" "$testDir" "$1" julia ./container.jl

+ 7 - 0
test/tests/run-node-in-container.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+set -e
+
+testDir="$(readlink -f "$(dirname "$BASH_SOURCE")")"
+runDir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
+
+source "$runDir/run-in-container.sh" "$testDir" "$1" node ./container.js

+ 7 - 0
test/tests/run-perl-in-container.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+set -e
+
+testDir="$(readlink -f "$(dirname "$BASH_SOURCE")")"
+runDir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
+
+source "$runDir/run-in-container.sh" "$testDir" "$1" perl ./container.pl

+ 7 - 0
test/tests/run-php-in-container.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+set -e
+
+testDir="$(readlink -f "$(dirname "$BASH_SOURCE")")"
+runDir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
+
+source "$runDir/run-in-container.sh" "$testDir" "$1" php ./container.php