diff --git a/test/debug.php b/test/debug.php
new file mode 100755
index 0000000..574ba86
--- /dev/null
+++ b/test/debug.php
@@ -0,0 +1,17 @@
+PHP');
+
+echo('
getenv()
');
+echo('');
+foreach (getenv() as $k => $v)
+ echo("$k | $v |
");
+echo('
');
+
+echo(getcwd());
+
+echo('
');
+
+require(dirname(__FILE__).'/web.php');
+
+?>
diff --git a/test/debug.py b/test/debug.py
new file mode 100755
index 0000000..e15865a
--- /dev/null
+++ b/test/debug.py
@@ -0,0 +1,14 @@
+#! /usr/bin/env python3
+
+import web
+
+
+web.print_headers_if_needed()
+
+print('Python
')
+
+print('os.environ
')
+web.print_environment()
+
+print('variables
')
+web.print_variables()
diff --git a/test/index.cgi b/test/index.cgi
new file mode 100755
index 0000000..79d83db
--- /dev/null
+++ b/test/index.cgi
@@ -0,0 +1,15 @@
+#! /usr/bin/env python3
+
+from waitress import serve
+
+
+def app():
+ import web
+ web.print_headers_if_needed()
+ counter += 1
+ print('Counter: {}'.format(counter))
+
+
+if __name__ == '__main__':
+ counter = 0
+ serve(app, unix_socket='/var/run/fcgiwrap.socket')
diff --git a/test/web.php b/test/web.php
new file mode 100644
index 0000000..0e2e32a
--- /dev/null
+++ b/test/web.php
@@ -0,0 +1,18 @@
+
diff --git a/test/web.py b/test/web.py
new file mode 100644
index 0000000..795f058
--- /dev/null
+++ b/test/web.py
@@ -0,0 +1,36 @@
+import os
+
+VARIABLES = [
+ 'REMOTE_ADDR',
+ 'SERVER_ADDR',
+ 'HTTPS',
+ 'REQUEST_SCHEME',
+ 'HTTP_HOST',
+ 'SERVER_NAME',
+ 'SCRIPT_NAME',
+ 'QUERY_STRING',
+]
+
+
+def print_headers_if_needed():
+ if not os.environ['SCRIPT_NAME'].endswith('.php'):
+ print('Content-Type: text/html;charset=UTF-8')
+ print()
+
+
+def print_environment():
+ print('')
+ for key, value in sorted(os.environ.items()):
+ print('''
+{} | {} |
+'''.format(key, value))
+ print('
')
+
+
+def print_variables():
+ print('')
+ for v in VARIABLES:
+ print('''
+{} | {} |
+'''.format(v, os.environ[v]))
+ print('
')