Skip to content

[clang-doc] Add testing without --repository for HTML documentation #131894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 19, 2025

Conversation

ilovepi
Copy link
Contributor

@ilovepi ilovepi commented Mar 18, 2025

#131697 reported a crash when
--repository was unused, so make sure we test the project in both
configurations.

@ilovepi ilovepi requested review from PeterChou1 and petrhosek March 18, 2025 19:25
@ilovepi ilovepi marked this pull request as ready for review March 18, 2025 19:25
@llvmbot
Copy link
Member

llvmbot commented Mar 18, 2025

@llvm/pr-subscribers-clang-tools-extra

Author: Paul Kirth (ilovepi)

Changes

#131697 reported a crash when
--repository was unused, so make sure we test the project in both
configurations.


Full diff: https://github.com/llvm/llvm-project/pull/131894.diff

1 Files Affected:

  • (modified) clang-tools-extra/test/clang-doc/basic-project.test (+109-73)
diff --git a/clang-tools-extra/test/clang-doc/basic-project.test b/clang-tools-extra/test/clang-doc/basic-project.test
index 1f5ba8bdc0703..20d2ddddfedbe 100644
--- a/clang-tools-extra/test/clang-doc/basic-project.test
+++ b/clang-tools-extra/test/clang-doc/basic-project.test
@@ -1,11 +1,19 @@
 // RUN: rm -rf %t && mkdir -p %t/docs %t/build
 // RUN: sed 's|$test_dir|%/S|g' %S/Inputs/basic-project/database_template.json > %t/build/compile_commands.json
-// RUN: clang-doc --format=html --output=%t/docs --executor=all-TUs %t/build/compile_commands.json --repository=https://repository.com
+// RUN: clang-doc --format=html --output=%t/docs --executor=all-TUs %t/build/compile_commands.json
 // RUN: FileCheck %s -input-file=%t/docs/index_json.js -check-prefix=JSON-INDEX
-// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Shape.html -check-prefix=HTML-SHAPE
-// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Calculator.html -check-prefix=HTML-CALC
-// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Rectangle.html -check-prefix=HTML-RECTANGLE
-// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Circle.html -check-prefix=HTML-CIRCLE
+// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Shape.html -check-prefixes=HTML-SHAPE,SHAPE-NO-REPOSITORY
+// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Calculator.html -check-prefixes=HTML-CALC,CALC-NO-REPOSITORY
+// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Rectangle.html -check-prefixes=HTML-RECTANGLE,RECTANGLE-NO-REPOSITORY
+// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Circle.html -check-prefixes=HTML-CIRCLE,CIRCLE-NO-REPOSITORY
+
+// RUN clang-doc --format=html --output=%t/docs --executor=all-TUs %t/build/compile_commands.json --repository=https://repository.com
+// RUN FileCheck %s -input-file=%t/docs/index_json.js -check-prefixes=JSON-INDEX,REPOSITORY
+// RUN FileCheck %s -input-file=%t/docs/GlobalNamespace/Shape.html -check-prefixes=HTML-SHAPE,SHAPE-REPOSITORY
+// RUN FileCheck %s -input-file=%t/docs/GlobalNamespace/Calculator.html -check-prefixes=HTML-CALC,CALC-REPOSITORY
+// RUN FileCheck %s -input-file=%t/docs/GlobalNamespace/Rectangle.html -check-prefixes=HTML-RECTANGLE,RECTANGLE-REPOSITORY
+// RUN FileCheck %s -input-file=%t/docs/GlobalNamespace/Circle.html -check-prefixes=HTML-CIRCLE,CIRCLE-REPOSITORY
+
 
 // JSON-INDEX: async function LoadIndex() {
 // JSON-INDEX-NEXT: return{
@@ -55,12 +63,13 @@
 // JSON-INDEX-NEXT: }
 
 //      HTML-SHAPE: <h1>class Shape</h1>
-// HTML-SHAPE-NEXT: <p>
-// HTML-SHAPE-NEXT: Defined at line
-// HTML-SHAPE-NEXT: <a href="https://repository.com/./include/Shape.h#8">8</a>
-// HTML-SHAPE-NEXT: of file
-// HTML-SHAPE-NEXT: <a href="https://repository.com/./include/Shape.h">Shape.h</a>
-// HTML-SHAPE-NEXT: </p>
+//   SHAPE-NO-REPOSITORY: <p>Defined at line 8 of file .{{.}}include{{.}}Shape.h</p>
+//      SHAPE-REPOSITORY: <p>
+// SHAPE-REPOSITORY-NEXT: Defined at line
+// SHAPE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Shape.h#8">8</a>
+// SHAPE-REPOSITORY-NEXT: of file
+// SHAPE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Shape.h">Shape.h</a>
+// SHAPE-REPOSITORY-NEXT: </p>
 //      HTML-SHAPE: <div>brief</div>
 //      HTML-SHAPE: <p> Abstract base class for shapes.</p>
 //      HTML-SHAPE: <p> Provides a common interface for different types of shapes.</p>
@@ -77,60 +86,72 @@
 //      HTML-SHAPE: <p> double The perimeter of the shape.</p>
 //      HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">~Shape</h3>
 //      HTML-SHAPE: <p>public void ~Shape()</p>
-//      HTML-SHAPE: Defined at line 
-// HTML-SHAPE-NEXT: <a href="https://repository.com/./include/Shape.h#13">13</a>
-// HTML-SHAPE-NEXT: of file 
-// HTML-SHAPE-NEXT: <a href="https://repository.com/./include/Shape.h">Shape.h</a>
+
+//   SHAPE-NO-REPOSITORY: Defined at line 13 of file .{{.}}include{{.}}Shape.h
+//      SHAPE-REPOSITORY: Defined at line 
+// SHAPE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Shape.h#13">13</a>
+// SHAPE-REPOSITORY-NEXT: of file 
+// SHAPE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Shape.h">Shape.h</a>
+
 //      HTML-SHAPE: <div>brief</div>
 //      HTML-SHAPE: <p> Virtual destructor.</p>
 
 //      HTML-CALC: <h1>class Calculator</h1>
-// HTML-CALC-NEXT: <p>
-// HTML-CALC-NEXT: Defined at line 
-// HTML-CALC-NEXT: <a href="https://repository.com/./include/Calculator.h#8">8</a>
-// HTML-CALC-NEXT: of file 
-// HTML-CALC-NEXT: <a href="https://repository.com/./include/Calculator.h">Calculator.h</a>
-// HTML-CALC-NEXT: </p>
+// CALC-NO-REPOSITORY: <p>Defined at line 8 of file .{{.}}include{{.}}Calculator.h</p>
+//      CALC-REPOSITORY: <p>
+// CALC-REPOSITORY-NEXT: Defined at line 
+// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./include/Calculator.h#8">8</a>
+// CALC-REPOSITORY-NEXT: of file 
+// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./include/Calculator.h">Calculator.h</a>
+// CALC-REPOSITORY-NEXT: </p>
 //      HTML-CALC: <div>brief</div>
 //      HTML-CALC: <p> A simple calculator class.</p>
 //      HTML-CALC: <p> Provides basic arithmetic operations.</p>
 //      HTML-CALC: <h2 id="Functions">Functions</h2>
 //      HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">add</h3>
 //      HTML-CALC: <p>public int add(int a, int b)</p>
-//      HTML-CALC: Defined at line 
-// HTML-CALC-NEXT: <a href="https://repository.com/./src/Calculator.cpp#3">3</a>
-// HTML-CALC-NEXT: of file 
-// HTML-CALC-NEXT: <a href="https://repository.com/./src/Calculator.cpp">Calculator.cpp</a>
+//   CALC-NO-REPOSITORY: Defined at line 3 of file .{{.}}src{{.}}Calculator.cpp
+//      CALC-REPOSITORY: Defined at line 
+// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp#3">3</a>
+// CALC-REPOSITORY-NEXT: of file 
+// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp">Calculator.cpp</a>
+
 //      HTML-CALC: <div>brief</div>
 //      HTML-CALC: <p> Adds two integers.</p>
 //      HTML-CALC: <div>return</div>
 //      HTML-CALC: <p> int The sum of a and b.</p>
 //      HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">subtract</h3>
 //      HTML-CALC: <p>public int subtract(int a, int b)</p>
-//      HTML-CALC: Defined at line 
-// HTML-CALC-NEXT: <a href="https://repository.com/./src/Calculator.cpp#7">7</a>
-// HTML-CALC-NEXT: of file 
-// HTML-CALC-NEXT: <a href="https://repository.com/./src/Calculator.cpp">Calculator.cpp</a>
+//   CALC-NO-REPOSITORY: Defined at line 7 of file .{{.}}src{{.}}Calculator.cpp
+//      CALC-REPOSITORY: Defined at line 
+// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp#7">7</a>
+// CALC-REPOSITORY-NEXT: of file 
+// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp">Calculator.cpp</a>
+
 //      HTML-CALC: <div>brief</div>
 //      HTML-CALC: <p> Subtracts the second integer from the first.</p>
 //      HTML-CALC: <div>return</div>
 //      HTML-CALC: <p> int The result of a - b.</p>
 //      HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">multiply</h3>
 //      HTML-CALC: <p>public int multiply(int a, int b)</p>
-//      HTML-CALC: Defined at line 
-// HTML-CALC-NEXT: <a href="https://repository.com/./src/Calculator.cpp#11">11</a>
-// HTML-CALC-NEXT: of file 
-// HTML-CALC-NEXT: <a href="https://repository.com/./src/Calculator.cpp">Calculator.cpp</a>
+//   CALC-NO-REPOSITORY: Defined at line 11 of file .{{.}}src{{.}}Calculator.cpp
+//      CALC-REPOSITORY: Defined at line 
+// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp#11">11</a>
+// CALC-REPOSITORY-NEXT: of file 
+// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp">Calculator.cpp</a>
+
 //      HTML-CALC: <div>brief</div>
 //      HTML-CALC: <p> Multiplies two integers.</p>
 //      HTML-CALC: <div>return</div>
 //      HTML-CALC: <p> int The product of a and b.</p>
 //      HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">divide</h3>
 //      HTML-CALC: <p>public double divide(int a, int b)</p>
-//      HTML-CALC: Defined at line 
-// HTML-CALC-NEXT: <a href="https://repository.com/./src/Calculator.cpp#15">15</a>
-// HTML-CALC-NEXT: of file 
-// HTML-CALC-NEXT: <a href="https://repository.com/./src/Calculator.cpp">Calculator.cpp</a>
+//   CALC-NO-REPOSITORY: Defined at line 15 of file .{{.}}src{{.}}Calculator.cpp
+//      CALC-REPOSITORY: Defined at line 
+// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp#15">15</a>
+// CALC-REPOSITORY-NEXT: of file 
+// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp">Calculator.cpp</a>
+
 //      HTML-CALC: <div>brief</div>
 //      HTML-CALC: <p> Divides the first integer by the second.</p>
 //      HTML-CALC: <div>return</div>
@@ -139,12 +160,14 @@
 //      HTML-CALC: <p>if b is zero.</p>
 
 //      HTML-RECTANGLE: <h1>class Rectangle</h1>
-// HTML-RECTANGLE-NEXT: <p>
-// HTML-RECTANGLE-NEXT: Defined at line
-// HTML-RECTANGLE-NEXT: <a href="https://repository.com/./include/Rectangle.h#10">10</a>
-// HTML-RECTANGLE-NEXT: of file 
-// HTML-RECTANGLE-NEXT: <a href="https://repository.com/./include/Rectangle.h">Rectangle.h</a>
-// HTML-RECTANGLE-NEXT: </p>
+// RECTANGLE-NO-REPOSITORY: <p>Defined at line 10 of file .{{.}}include{{.}}Rectangle.h</p>
+//      RECTANGLE-REPOSITORY: <p>
+// RECTANGLE-REPOSITORY-NEXT: Defined at line
+// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Rectangle.h#10">10</a>
+// RECTANGLE-REPOSITORY-NEXT: of file 
+// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Rectangle.h">Rectangle.h</a>
+// RECTANGLE-REPOSITORY-NEXT: </p>
+
 //      HTML-RECTANGLE: <p> Represents a rectangle with a given width and height.</p>
 //      HTML-RECTANGLE: <p>
 //      HTML-RECTANGLE:   Inherits from
@@ -158,40 +181,47 @@
 //      HTML-RECTANGLE: <h2 id="Functions">Functions</h2>
 //      HTML-RECTANGLE: <h3 id="{{([0-9A-F]{40})}}">Rectangle</h3>
 //      HTML-RECTANGLE: <p>public void Rectangle(double width, double height)</p>
-//      HTML-RECTANGLE: Defined at line
-// HTML-RECTANGLE-NEXT: <a href="https://repository.com/./src/Rectangle.cpp#3">3</a>
-// HTML-RECTANGLE-NEXT: of file 
-// HTML-RECTANGLE-NEXT: <a href="https://repository.com/./src/Rectangle.cpp">Rectangle.cpp</a>
+//   RECTANGLE-NO-REPOSITORY: Defined at line 3 of file .{{.}}src{{.}}Rectangle.cpp
+//      RECTANGLE-REPOSITORY: Defined at line
+// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Rectangle.cpp#3">3</a>
+// RECTANGLE-REPOSITORY-NEXT: of file 
+// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Rectangle.cpp">Rectangle.cpp</a>
+
 //      HTML-RECTANGLE: <div>brief</div>
 //      HTML-RECTANGLE: <p> Constructs a new Rectangle object.</p>
 //      HTML-RECTANGLE: <h3 id="{{([0-9A-F]{40})}}">area</h3>
 //      HTML-RECTANGLE: <p>public double area()</p>
-//      HTML-RECTANGLE: Defined at line
-// HTML-RECTANGLE-NEXT: <a href="https://repository.com/./src/Rectangle.cpp#6">6</a>
-// HTML-RECTANGLE-NEXT: of file 
-// HTML-RECTANGLE-NEXT: <a href="https://repository.com/./src/Rectangle.cpp">Rectangle.cpp</a>
+//   RECTANGLE-NO-REPOSITORY: Defined at line 6 of file .{{.}}src{{.}}Rectangle.cpp
+//      RECTANGLE-REPOSITORY: Defined at line
+// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Rectangle.cpp#6">6</a>
+// RECTANGLE-REPOSITORY-NEXT: of file 
+// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Rectangle.cpp">Rectangle.cpp</a>
+
 //      HTML-RECTANGLE: <div>brief</div>
 //      HTML-RECTANGLE: <p> Calculates the area of the rectangle.</p>
 //      HTML-RECTANGLE: <div>return</div>
 //      HTML-RECTANGLE: <p> double The area of the rectangle.</p>
 //      HTML-RECTANGLE: <h3 id="{{([0-9A-F]{40})}}">perimeter</h3>
 //      HTML-RECTANGLE: <p>public double perimeter()</p>
-//      HTML-RECTANGLE: Defined at line
-// HTML-RECTANGLE-NEXT: <a href="https://repository.com/./src/Rectangle.cpp#10">10</a>
-// HTML-RECTANGLE-NEXT: of file 
-// HTML-RECTANGLE-NEXT: <a href="https://repository.com/./src/Rectangle.cpp">Rectangle.cpp</a>
+//   RECTANGLE-NO-REPOSITORY: Defined at line 10 of file .{{.}}src{{.}}Rectangle.cpp
+//      RECTANGLE-REPOSITORY: Defined at line
+// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Rectangle.cpp#10">10</a>
+// RECTANGLE-REPOSITORY-NEXT: of file 
+// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Rectangle.cpp">Rectangle.cpp</a>
 //      HTML-RECTANGLE: <div>brief</div>
 //      HTML-RECTANGLE: <p> Calculates the perimeter of the rectangle.</p>
 //      HTML-RECTANGLE: <div>return</div>
 //      HTML-RECTANGLE: <p> double The perimeter of the rectangle.</p>
 
 //      HTML-CIRCLE: <h1>class Circle</h1>
-// HTML-CIRCLE-NEXT: <p>
-// HTML-CIRCLE-NEXT: Defined at line 
-// HTML-CIRCLE-NEXT: <a href="https://repository.com/./include/Circle.h#10">10</a>
-// HTML-CIRCLE-NEXT: of file 
-// HTML-CIRCLE-NEXT: <a href="https://repository.com/./include/Circle.h">Circle.h</a>
-// HTML-CIRCLE-NEXT: </p>
+// CIRCLE-NO-REPOSITORY: <p>Defined at line 10 of file .{{.}}include{{.}}Circle.h</p>
+//      CIRCLE-REPOSITORY: <p>
+// CIRCLE-REPOSITORY-NEXT: Defined at line 
+// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Circle.h#10">10</a>
+// CIRCLE-REPOSITORY-NEXT: of file 
+// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Circle.h">Circle.h</a>
+// CIRCLE-REPOSITORY-NEXT: </p>
+
 //      HTML-CIRCLE: <div>brief</div>
 //      HTML-CIRCLE: <p> Circle class derived from Shape.</p>
 //      HTML-CIRCLE: <p> Represents a circle with a given radius.</p>
@@ -205,28 +235,34 @@
 //      HTML-CIRCLE: <h2 id="Functions">Functions</h2>
 //      HTML-CIRCLE: <h3 id="{{([0-9A-F]{40})}}">Circle</h3>
 //      HTML-CIRCLE: <p>public void Circle(double radius)</p>
-//      HTML-CIRCLE: Defined at line 
-// HTML-CIRCLE-NEXT: <a href="https://repository.com/./src/Circle.cpp#3">3</a>
-// HTML-CIRCLE-NEXT:  of file 
-// HTML-CIRCLE-NEXT: <a href="https://repository.com/./src/Circle.cpp">Circle.cpp</a>
+//   CIRCLE-NO-REPOSITORY: Defined at line 3 of file .{{.}}src{{.}}Circle.cpp
+//      CIRCLE-REPOSITORY: Defined at line 
+// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Circle.cpp#3">3</a>
+// CIRCLE-REPOSITORY-NEXT:  of file 
+// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Circle.cpp">Circle.cpp</a>
+
 //      HTML-CIRCLE: <div>brief</div>
 //      HTML-CIRCLE: <p> Constructs a new Circle object.</p>
 //      HTML-CIRCLE: <h3 id="{{([0-9A-F]{40})}}">area</h3>
 //      HTML-CIRCLE: <p>public double area()</p>
-//      HTML-CIRCLE: Defined at line 
-// HTML-CIRCLE-NEXT: <a href="https://repository.com/./src/Circle.cpp#5">5</a>
-// HTML-CIRCLE-NEXT:  of file 
-// HTML-CIRCLE-NEXT: <a href="https://repository.com/./src/Circle.cpp">Circle.cpp</a>
+//   CIRCLE-NO-REPOSITORY: Defined at line 5 of file .{{.}}src{{.}}Circle.cpp
+//      CIRCLE-REPOSITORY: Defined at line 
+// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Circle.cpp#5">5</a>
+// CIRCLE-REPOSITORY-NEXT:  of file 
+// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Circle.cpp">Circle.cpp</a>
+
 //      HTML-CIRCLE: <div>brief</div>
 //      HTML-CIRCLE: <p> Calculates the area of the circle.</p>
 //      HTML-CIRCLE: <div>return</div>
 //      HTML-CIRCLE: <p> double The area of the circle.</p>
 //      HTML-CIRCLE: <h3 id="{{([0-9A-F]{40})}}">perimeter</h3>
 //      HTML-CIRCLE: <p>public double perimeter()</p>
-//      HTML-CIRCLE: Defined at line 
-// HTML-CIRCLE-NEXT: <a href="https://repository.com/./src/Circle.cpp#9">9</a>
-// HTML-CIRCLE-NEXT:  of file 
-// HTML-CIRCLE-NEXT: <a href="https://repository.com/./src/Circle.cpp">Circle.cpp</a>
+//   CIRCLE-NO-REPOSITORY: Defined at line  9 of file .{{.}}src{{.}}Circle.cpp
+//      CIRCLE-REPOSITORY: Defined at line 
+// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Circle.cpp#9">9</a>
+// CIRCLE-REPOSITORY-NEXT:  of file 
+// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Circle.cpp">Circle.cpp</a>
+
 //      HTML-CIRCLE: <div>brief</div>
 //      HTML-CIRCLE: <p> Calculates the perimeter of the circle.</p>
 //      HTML-CIRCLE: <div>return</div>

#131697 reported a crash when
--repository was unused, so make sure we test the project in both
configurations.
Copy link
Contributor Author

ilovepi commented Mar 19, 2025

Merge activity

  • Mar 19, 11:23 AM EDT: A user started a stack merge that includes this pull request via Graphite.
  • Mar 19, 11:24 AM EDT: A user merged this pull request with Graphite.

@ilovepi ilovepi merged commit 93b7c1b into main Mar 19, 2025
11 checks passed
@ilovepi ilovepi deleted the users/ilovepi/clang-doc-repository branch March 19, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants