Skip to content

Commit 72bdf53

Browse files
Make autotest/autotest.sh runnable & add ant task
Fixes w3c#17
1 parent 1eed592 commit 72bdf53

File tree

5 files changed

+44
-7
lines changed

5 files changed

+44
-7
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "autotest/testsuite"]
22
path = autotest/testsuite
33
url = https://github.com/w3c/css-validator-testsuite.git
4+
[submodule "testsuite"]
5+
path = testsuite
6+
url = https://github.com/w3c/css-validator-testsuite.git

autotest/AutoTestContentHandler.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@
3737
*/
3838
public class AutoTestContentHandler implements ContentHandler {
3939

40-
//public static final String VALIDATOR = "http://jigsaw.w3.org/css-validator/validator?";
41-
public static final String VALIDATOR = "http://qa-dev.w3.org:8001/css-validator/validator?";
40+
public static final String VALIDATOR = "http://jigsaw.w3.org/css-validator/validator?";
4241
public static final String PARAMS = "&output=soap12";
4342
public static final int TESTSUITE = "testsuite".hashCode();
4443
public static final int TEST = "test".hashCode();
@@ -264,12 +263,13 @@ public void endElement(String nameSpaceURI, String localName, String rawName)
264263
System.err.println(urlString);
265264
String validURL = createValidURL(urlString);
266265
if (isFile) {
267-
URL fileURL = AutoTestContentHandler.class
268-
.getResource(urlString);
269266
InputStream content;
270267
String text = "";
271268
try {
272-
content = fileURL.openStream();
269+
content = //
270+
AutoTestContentHandler.class //
271+
.getClassLoader()
272+
.getResourceAsStream(urlString);
273273
byte[] textBytes = new byte[content.available()];
274274
content.read(textBytes, 0, textBytes.length);
275275
text = createValidURL(new String(textBytes));

autotest/autotest.sh

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

3-
java -cp .:/usr/share/java/jaxp-1.2.jar:/usr/share/java/xercesImpl.jar:/usr/share/java/xmlParserAPIs.jar:/usr/local/Jigsaw/classes/jigsaw.jar autotest.AutoTest $1
3+
[[ ! -f css-validator.jar ]] && \
4+
echo && \
5+
echo "Building css-validator.jar..." && \
6+
ant -quiet jar
7+
8+
javac -classpath css-validator.jar \
9+
./autotest/AutoTest.java \
10+
./autotest/AutoTestContentHandler.java \
11+
./autotest/Result.java
12+
13+
[[ -z "$1" ]] && \
14+
echo && \
15+
echo "Error: autotest.sh failed to run" && \
16+
echo && \
17+
echo "Usage: autotest.sh ./testsuite/xml/FILENAME.xml" && \
18+
exit 1
19+
20+
java -cp css-validator.jar autotest.AutoTest "$1"

build.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,22 @@
148148
</war>
149149
</target>
150150

151+
<target name="autotest" depends="jar">
152+
<fail message="&#xa0;${line.separator}${line.separator}
153+
Usage: ant autotest -Dtestfile=testsuite/xml/FILENAME.xml">
154+
<condition>
155+
<not>
156+
<isset property="testfile"/>
157+
</not>
158+
</condition>
159+
</fail>
160+
<javac srcdir="autotest" classpath="css-validator.jar"
161+
includeantruntime="false"/>
162+
<java classname="autotest.AutoTest" classpath="css-validator.jar">
163+
<arg value="${testfile}"/>
164+
</java>
165+
</target>
166+
151167
<target name="clean" description="Cleans up generated files">
152168
<delete file="${jar.file}"/>
153169
<delete file="${war.file}"/>

testsuite

Submodule testsuite added at 22fc529

0 commit comments

Comments
 (0)