]> git.lizzy.rs Git - rust.git/commitdiff
Add a rustdoc test
authorCorey Richardson <corey@octayn.net>
Tue, 17 Dec 2013 17:05:36 +0000 (12:05 -0500)
committerCorey Richardson <corey@octayn.net>
Wed, 18 Dec 2013 20:21:30 +0000 (15:21 -0500)
This is just a smoke test which verifies that the expected files are
generated. Also makes the rmake tests have the right deps.

mk/tests.mk
src/etc/maketest.py
src/test/run-make/rustdoc-smoke/Makefile [new file with mode: 0644]
src/test/run-make/rustdoc-smoke/foo.rs [new file with mode: 0644]
src/test/run-make/rustdoc-smoke/verify.sh [new file with mode: 0755]

index f266a8975b4b31926a53c0393987af76ab102bbb..b026055ab25b45eebb59b48df3403096de16bf6f 100644 (file)
@@ -920,14 +920,15 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),rmake): \
 
 $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
                $(S)src/test/run-make/%/Makefile \
-               $$(HSREQ$(1)_H_$(3))
+               $$(CSREQ$(1)_T_$(2)_H_$(3))
        @rm -rf $(3)/test/run-make/$$*
        @mkdir -p $(3)/test/run-make/$$*
        @echo maketest: $$*
        $$(Q)$$(CFG_PYTHON) $(S)src/etc/maketest.py $$(dir $$<) \
            $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
            $(3)/test/run-make/$$* \
-           "$$(CC_$(3)) $$(CFG_GCCISH_CFLAGS_$(3))"
+           "$$(CC_$(3)) $$(CFG_GCCISH_CFLAGS_$(3))" \
+           $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3))
        @touch $$@
 
 endef
index 96c658e56864b2f3b3f2e6fc7a25cfc751936dd1..00d80e1bf4d1d7f0180de54d9d25164fba1d00e1 100644 (file)
@@ -7,6 +7,7 @@ import sys
 os.putenv('RUSTC', os.path.abspath(sys.argv[2]))
 os.putenv('TMPDIR', os.path.abspath(sys.argv[3]))
 os.putenv('CC', sys.argv[4])
+os.putenv('RUSTDOC', os.path.abspath(sys.argv[5]))
 
 proc = subprocess.Popen(['make', '-C', sys.argv[1]],
                         stdout = subprocess.PIPE,
diff --git a/src/test/run-make/rustdoc-smoke/Makefile b/src/test/run-make/rustdoc-smoke/Makefile
new file mode 100644 (file)
index 0000000..0de678e
--- /dev/null
@@ -0,0 +1,5 @@
+-include ../tools.mk
+all:
+       $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
+       cp verify.sh $(TMPDIR)
+       $(call RUN,verify.sh) $(TMPDIR)
diff --git a/src/test/run-make/rustdoc-smoke/foo.rs b/src/test/run-make/rustdoc-smoke/foo.rs
new file mode 100644 (file)
index 0000000..7a86bf4
--- /dev/null
@@ -0,0 +1,15 @@
+#[pkgid = "foo#0.1"];
+
+//! Very docs
+
+pub mod bar {
+
+    /// So correct
+    pub mod baz {
+        /// Much detail
+        pub fn baz() { }
+    }
+
+    /// *wow*
+    pub trait Doge { }
+}
diff --git a/src/test/run-make/rustdoc-smoke/verify.sh b/src/test/run-make/rustdoc-smoke/verify.sh
new file mode 100755 (executable)
index 0000000..18f3939
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# $1 is the TMPDIR
+
+dirs="doc doc/foo doc/foo/bar doc/foo/bar/baz doc/src doc/src/foo"
+
+for dir in $dirs; do if [ ! -d $1/$dir ]; then
+       echo "$1/$dir is not a directory!"
+       exit 1
+fi done
+
+files="doc/foo/index.html doc/foo/bar/index.html doc/foo/bar/baz/fn.baz.html doc/foo/bar/trait.Doge.html doc/src/foo/foo.rs.html"
+
+for file in $files; do if [ ! -f $1/$file ]; then
+       echo "$1/$file is not a file!"
+       exit 1
+fi done