Adding initial testing scripts.

Signed-off-by: Tim 'mithro' Ansell <tansell@google.com>
diff --git a/open_pdks/build-magic.sh b/open_pdks/build-magic.sh
new file mode 100755
index 0000000..0a08fe6
--- /dev/null
+++ b/open_pdks/build-magic.sh
@@ -0,0 +1,60 @@
+# Copyright 2021 SkyWater PDK Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+set -xe
+
+apt-get update -qq
+
+export DEBIAN_FRONTEND=noninteractive
+
+apt-get -y install --no-install-recommends \
+    ca-certificates \
+    curl \
+    wget \
+    python3 \
+
+apt-get -y install --no-install-recommends \
+    build-essential \
+    git \
+    make \
+
+apt-get -y install --no-install-recommends \
+    csh \
+    libcairo2-dev \
+    libglu1-mesa-dev \
+    libncurses-dev \
+    libx11-dev \
+    m4 \
+    python3-dev \
+    tcl \
+    tcl-dev \
+    tcl-expect \
+    tcsh \
+    tk-dev \
+
+apt-get autoclean
+apt-get clean
+apt-get -y autoremove
+rm -rf /var/lib/apt/lists/*
+
+cd /host
+echo $PWD
+ls -l
+cd magic
+./configure --prefix=/host/out/magic
+make -j$(nproc)
+make install
+find /host/out
diff --git a/open_pdks/build-open_pdks.sh b/open_pdks/build-open_pdks.sh
new file mode 100755
index 0000000..54cbd20
--- /dev/null
+++ b/open_pdks/build-open_pdks.sh
@@ -0,0 +1,108 @@
+# Copyright 2021 SkyWater PDK Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+set -xe
+
+export PATH=/host/out/magic/bin:$PATH
+
+cd /host
+ls -l
+cd open_pdks
+
+POSSIBLE_TOOLS="all" # klayout magic netgen irsim openlane qflow xschem"
+for TTOOL in $POSSIBLE_TOOLS; do
+
+  #  --enable-klayout
+  if [ x$TTOOL = xklayout -o x$TTOOL = xall ]; then
+    KLAYOUT=--enable-klayout
+  else
+    KLAYOUT=--disable-klayout
+  fi
+
+  #  --enable-magic
+  if [ x$TTOOL = xmagic -o x$TTOOL = xall  ]; then
+    MAGIC=--enable-magic
+  else
+    MAGIC=--disable-magic
+  fi
+
+  #  --enable-netgen
+  if [ x$TTOOL = xnetgen -o x$TTOOL = xall ]; then
+    NETGEN=--enable-netgen
+  else
+    NETGEN=--disable-netgen
+  fi
+
+  #  --enable-irsim
+  if [ x$TTOOL = xirsim -o x$TTOOL = xall ]; then
+    IRSIM=--enable-irsim
+  else
+    IRSIM=--disable-irsim
+  fi
+
+  #  --enable-openlane
+  if [ x$TTOOL = xopenlane -o x$TTOOL = xall ]; then
+    OPENLANE=--enable-openlane
+  else
+    OPENLANE=--disable-openlane
+  fi
+
+  #  --enable-qflow
+  if [ x$TTOOL = xqflow -o x$TTOOL = xall ]; then
+    QFLOW=--enable-qflow
+  else
+    QFLOW=--disable-qflow
+  fi
+
+  #  --enable-xschem
+  if [ x$TTOOL = xxschem -o x$TTOOL = xall ]; then
+    XSCHEM=--enable-xschem
+  else
+    XSCHEM=--disable-xschem
+  fi
+
+  echo
+  echo "========================================="
+  echo " Building PDK files for $TTOOL"
+  echo "-----------------------------------------"
+  ./configure \
+	--enable-sky130-pdk=/host/skywater-pdk \
+	--enable-alpha-sky130 \
+	--prefix=/usr/local \
+        $KLAYOUT \
+        $MAGIC \
+        $NETGEN \
+        $IRSIM \
+        $OPENLANE \
+        $QFLOW \
+        $XSCHEM \
+
+  make -j$(nproc) > /host/out/pdk-$TTOOL.build.log
+  make DESTDIR=/host/out/pdk-$TTOOL install > /host/out/pdk-$TTOOL.install.log
+  echo "========================================="
+
+  echo
+  echo "========================================="
+  echo " PDK files for $TTOOL"
+  echo "-----------------------------------------"
+  find /host/out/pdk-$TTOOL | sort
+  echo "========================================="
+  echo
+  if [ ! -d /host/out/pdk-$TTOOL ]; then
+     echo "Missing install files for $TTOOL"
+     exit 1
+  fi
+done
diff --git a/open_pdks/build-skywater-pdk.sh b/open_pdks/build-skywater-pdk.sh
new file mode 100755
index 0000000..d87e9e2
--- /dev/null
+++ b/open_pdks/build-skywater-pdk.sh
@@ -0,0 +1,30 @@
+# Copyright 2021 SkyWater PDK Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+set -xe
+
+cd /host
+ls -l
+cd skywater-pdk
+git describe
+
+git submodule init libraries/sky130_fd_io/latest
+git submodule init libraries/sky130_fd_pr/latest
+git submodule init libraries/sky130_fd_sc_hd/latest
+git submodule init libraries/sky130_fd_sc_hvl/latest
+git submodule update
+
+make timing
diff --git a/open_pdks/continous.cfg b/open_pdks/continous.cfg
new file mode 100644
index 0000000..2f16e7a
--- /dev/null
+++ b/open_pdks/continous.cfg
@@ -0,0 +1,11 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+build_file: "vtr-verilog-to-routing-kokoro/run-vtr-symbiflow.sh"
+
+timeout_mins: 4320
+
+action {
+  define_artifacts {
+    # File types
+  }
+}
diff --git a/open_pdks/run.sh b/open_pdks/run.sh
new file mode 100755
index 0000000..f6f9201
--- /dev/null
+++ b/open_pdks/run.sh
@@ -0,0 +1,59 @@
+#!/usr/bin/bash
+# Copyright 2021 SkyWater PDK Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+set -xe
+
+# This script tries to follows the instructions in the README @
+# https://github.com/RTimothyEdwards/open_pdks/tree/master/sky130 with a couple
+# of differences;
+# 1) It uses the git repositories already cloned by Kokoro
+# 2) It runs inside a Docker container
+
+# Cleanup any existing docker build
+docker stop --time 0 builder || true
+docker rm builder || true
+rm -rf out
+
+# Start the docker container to do the build inside.
+docker run -dt \
+  --mount type=bind,source="$(pwd)",target=/host \
+  --name builder \
+  debian || docker start builder
+
+docker ps
+
+function kill_docker_builder {
+	docker stop --time 0 builder || true
+	docker ps
+}
+trap kill_docker_builder EXIT
+
+DOCKER_CMD="docker exec builder"
+
+$DOCKER_CMD ls /host
+
+# Build Magic in a container from the cloned magic repository
+$DOCKER_CMD bash /host/build-magic.sh
+
+# Run `make timing` inside the cloned skywater-pdk repository
+$DOCKER_CMD bash /host/build-skywater-pdk.sh
+
+# Run `./configure` targeting the output directory.
+$DOCKER_CMD bash /host/build-open_pdks.sh
+
+# Tar up result.
+find out/pdk-* | sort | tee pdk.files