Skip to content

Commit b6933f8

Browse files
committed
auto merge of #11032 : cmr/rust/rustdoc_test, r=alexcrichton
This is just a smoke test which verifies that the expected files are generated.
2 parents c87b9d3 + 21bec4f commit b6933f8

File tree

6 files changed

+50
-5
lines changed

6 files changed

+50
-5
lines changed

mk/tests.mk

Lines changed: 3 additions & 2 deletions
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

Lines changed: 1 addition & 0 deletions
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,

src/librustdoc/html/render.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -678,15 +678,21 @@ impl Context {
678678
// using a rwarc makes this parallelizable in the future
679679
local_data::set(cache_key, Arc::new(cache));
680680

681-
self.item(item);
681+
let mut work = ~[(self, item)];
682+
while work.len() > 0 {
683+
let (mut cx, item) = work.pop();
684+
cx.item(item, |cx, item| {
685+
work.push((cx.clone(), item));
686+
})
687+
}
682688
}
683689

684690
/// Non-parellelized version of rendering an item. This will take the input
685691
/// item, render its contents, and then invoke the specified closure with
686692
/// all sub-items which need to be rendered.
687693
///
688694
/// The rendering driver uses this closure to queue up more work.
689-
fn item(&mut self, item: clean::Item) {
695+
fn item(&mut self, item: clean::Item, f: |&mut Context, clean::Item|) {
690696
fn render(w: io::File, cx: &mut Context, it: &clean::Item,
691697
pushname: bool) {
692698
info!("Rendering an item to {}", w.path().display());
@@ -733,7 +739,7 @@ impl Context {
733739
};
734740
this.sidebar = build_sidebar(&m);
735741
for item in m.items.move_iter() {
736-
this.item(item);
742+
f(this,item);
737743
}
738744
})
739745
}
Lines changed: 5 additions & 0 deletions
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)
Lines changed: 15 additions & 0 deletions
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+
}
Lines changed: 17 additions & 0 deletions
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)