Skip to content

Commit 5d45170

Browse files
committed
Add a rustdoc test
This is just a smoke test which verifies that the expected files are generated. Also makes the rmake tests have the right deps.
1 parent c335734 commit 5d45170

File tree

5 files changed

+41
-2
lines changed

5 files changed

+41
-2
lines changed

mk/tests.mk

+3-2
Original file line numberDiff line numberDiff line change
@@ -920,14 +920,15 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),rmake): \
920920

921921
$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
922922
$(S)src/test/run-make/%/Makefile \
923-
$$(HSREQ$(1)_H_$(3))
923+
$$(CSREQ$(1)_T_$(2)_H_$(3))
924924
@rm -rf $(3)/test/run-make/$$*
925925
@mkdir -p $(3)/test/run-make/$$*
926926
@echo maketest: $$*
927927
$$(Q)$$(CFG_PYTHON) $(S)src/etc/maketest.py $$(dir $$<) \
928928
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
929929
$(3)/test/run-make/$$* \
930-
"$$(CC_$(3)) $$(CFG_GCCISH_CFLAGS_$(3))"
930+
"$$(CC_$(3)) $$(CFG_GCCISH_CFLAGS_$(3))" \
931+
$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3))
931932
@touch $$@
932933

933934
endef

src/etc/maketest.py

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
os.putenv('RUSTC', os.path.abspath(sys.argv[2]))
88
os.putenv('TMPDIR', os.path.abspath(sys.argv[3]))
99
os.putenv('CC', sys.argv[4])
10+
os.putenv('RUSTDOC', os.path.abspath(sys.argv[5]))
1011

1112
proc = subprocess.Popen(['make', '-C', sys.argv[1]],
1213
stdout = subprocess.PIPE,
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-include ../tools.mk
2+
all:
3+
$(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
4+
cp verify.sh $(TMPDIR)
5+
$(call RUN,verify.sh) $(TMPDIR)
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#[pkgid = "foo#0.1"];
2+
3+
//! Very docs
4+
5+
pub mod bar {
6+
7+
/// So correct
8+
pub mod baz {
9+
/// Much detail
10+
pub fn baz() { }
11+
}
12+
13+
/// *wow*
14+
pub trait Doge { }
15+
}
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
# $1 is the TMPDIR
4+
5+
dirs="doc doc/foo doc/foo/bar doc/foo/bar/baz doc/src doc/src/foo"
6+
7+
for dir in $dirs; do if [ ! -d $1/$dir ]; then
8+
echo "$1/$dir is not a directory!"
9+
exit 1
10+
fi done
11+
12+
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"
13+
14+
for file in $files; do if [ ! -f $1/$file ]; then
15+
echo "$1/$file is not a file!"
16+
exit 1
17+
fi done

0 commit comments

Comments
 (0)