Skip to content

Commit 4ae8630

Browse files
authored
Rename tools (#123)
1 parent ba4e381 commit 4ae8630

File tree

12 files changed

+33
-29
lines changed

12 files changed

+33
-29
lines changed

docs/development.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ manager.queueCommand?
312312
manager.queueCommand(
313313
"ReduceVariant for xxx",
314314
[
315-
"reduce_variant",
315+
"glsl-reduce",
316316
"--reference", "processing/7093366951813584254/test_exp/recipient.info.json",
317317
"--reduce_everywhere",
318318
"--output", "processing/7093366951813584254/test_variant_1_inv",

python/src/main/python/drivers/reduce.bat python/src/main/python/drivers/glsl-generate.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
@REM limitations under the License.
1717
@REM
1818

19-
python "%~dp0reduce.py" %*
19+
python "%~dpn0.py" %*

python/src/main/python/drivers/generate_shader_families.bat python/src/main/python/drivers/glsl-reduce.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
@REM limitations under the License.
1717
@REM
1818

19-
python "%~dp0generate_shader_families.py" %*
19+
python "%~dpn0.py" %*

reducer/src/main/java/com/graphicsfuzz/reducer/tool/Reduce.java reducer/src/main/java/com/graphicsfuzz/reducer/tool/GlslReduce.java

+11-6
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,24 @@
5858
import org.slf4j.Logger;
5959
import org.slf4j.LoggerFactory;
6060

61-
public class Reduce {
61+
public class GlslReduce {
6262

63-
private static final Logger LOGGER = LoggerFactory.getLogger(Reduce.class);
63+
private static final Logger LOGGER = LoggerFactory.getLogger(GlslReduce.class);
6464

6565
private static ArgumentParser getParser() {
6666

67-
ArgumentParser parser = ArgumentParsers.newArgumentParser("Reduce")
68-
.defaultHelp(true)
69-
.description("Reduce a shader job, driven by a criterion of interest.");
67+
ArgumentParser parser = ArgumentParsers.newArgumentParser("glsl-reduce")
68+
.defaultHelp(true)
69+
.description("Reduce GLSL shaders, driven by a criterion of interest. "
70+
+ "The tool takes a \"shader job\" as input, "
71+
+ "which is a set of files with the same name (e.g. NAME) in the same directory, "
72+
+ "including NAME.json (a metadata file that can be empty) "
73+
+ "and some graphics shaders (NAME.frag and/or NAME.vert) "
74+
+ "or a compute shader (NAME.comp).");
7075

7176
// Required arguments
7277
parser.addArgument("shader_job")
73-
.help("Path of shader job to be reduced. E.g. /path/to/variant.json ")
78+
.help("Path of shader job to be reduced. E.g. /path/to/shaderjob.json ")
7479
.type(File.class);
7580

7681
parser.addArgument("reduction_kind")

reducer/src/test/java/com/graphicsfuzz/reducer/tool/ReduceTest.java reducer/src/test/java/com/graphicsfuzz/reducer/tool/GlslReduceTest.java

+9-10
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.graphicsfuzz.reducer.tool;
1818

19-
import com.graphicsfuzz.common.glslversion.ShadingLanguageVersion;
2019
import com.graphicsfuzz.common.util.CompareAsts;
2120
import com.graphicsfuzz.common.util.ParseHelper;
2221
import com.graphicsfuzz.common.util.ParseTimeoutException;
@@ -30,15 +29,15 @@
3029
import static org.junit.Assert.assertEquals;
3130
import static org.junit.Assert.assertTrue;
3231

33-
public class ReduceTest {
32+
public class GlslReduceTest {
3433

3534
@Rule
3635
public TemporaryFolder temporaryFolder = new TemporaryFolder();
3736

3837
@Test
3938
public void noServerAllowedInCustomReduction() throws Exception {
4039
try {
41-
Reduce.mainHelper(new String[]{"--server", "some_server", "--token", "some_token",
40+
GlslReduce.mainHelper(new String[]{"--server", "some_server", "--token", "some_token",
4241
makeShaderJobAndReturnJsonFilename(), "CUSTOM", "--output",
4342
temporaryFolder.getRoot().getAbsolutePath()}
4443
, null);
@@ -51,7 +50,7 @@ public void noServerAllowedInCustomReduction() throws Exception {
5150
@Test
5251
public void noTokenAllowedInCustomReduction() throws Exception {
5352
try {
54-
Reduce.mainHelper(new String[]{"--token", "some_token",
53+
GlslReduce.mainHelper(new String[]{"--token", "some_token",
5554
makeShaderJobAndReturnJsonFilename(), "CUSTOM", "--output",
5655
temporaryFolder.getRoot().getAbsolutePath()}, null);
5756
assertTrue(false);
@@ -63,7 +62,7 @@ public void noTokenAllowedInCustomReduction() throws Exception {
6362
@Test
6463
public void noErrorStringAllowedInCustomReduction() throws Exception {
6564
try {
66-
Reduce.mainHelper(new String[]{"--error_string", "some_string",
65+
GlslReduce.mainHelper(new String[]{"--error_string", "some_string",
6766
makeShaderJobAndReturnJsonFilename(), "CUSTOM", "--output",
6867
temporaryFolder.getRoot().getAbsolutePath()}, null);
6968
assertTrue(false);
@@ -75,7 +74,7 @@ public void noErrorStringAllowedInCustomReduction() throws Exception {
7574
@Test
7675
public void noReferenceAllowedInCustomReduction() throws Exception {
7776
try {
78-
Reduce.mainHelper(new String[]{"--reference", "reference.info.json",
77+
GlslReduce.mainHelper(new String[]{"--reference", "reference.info.json",
7978
makeShaderJobAndReturnJsonFilename(),
8079
"CUSTOM", "--output", temporaryFolder.getRoot().getAbsolutePath()}, null);
8180
assertTrue(false);
@@ -91,7 +90,7 @@ private void checkOptionNotAllowed(RuntimeException exception, String option) {
9190
@Test
9291
public void noCustomJudgeAllowedInNonCustomReduction() throws Exception {
9392
try {
94-
Reduce.mainHelper(new String[]{makeShaderJobAndReturnJsonFilename(), "NO_IMAGE",
93+
GlslReduce.mainHelper(new String[]{makeShaderJobAndReturnJsonFilename(), "NO_IMAGE",
9594
"--custom_judge", "somejudgescript", "--output",
9695
temporaryFolder.getRoot().getAbsolutePath()},
9796
null);
@@ -105,7 +104,7 @@ public void noCustomJudgeAllowedInNonCustomReduction() throws Exception {
105104
@Test
106105
public void customJudgeRequiredInCustomReduction() throws Exception {
107106
try {
108-
Reduce.mainHelper(new String[]{makeShaderJobAndReturnJsonFilename(), "CUSTOM", "--output",
107+
GlslReduce.mainHelper(new String[]{makeShaderJobAndReturnJsonFilename(), "CUSTOM", "--output",
109108
temporaryFolder.getRoot().getAbsolutePath()}, null);
110109
assertTrue(false);
111110
} catch (RuntimeException exception) {
@@ -120,7 +119,7 @@ public void checkCustomJudgeIsExecutable() throws Exception {
120119
final File jsonFile = getShaderJobReady();
121120
final File emptyFile = temporaryFolder.newFile(); // Not executable
122121
try {
123-
Reduce.mainHelper(new String[]{
122+
GlslReduce.mainHelper(new String[]{
124123
jsonFile.getAbsolutePath(),
125124
"CUSTOM",
126125
"--custom_judge",
@@ -139,7 +138,7 @@ public void testAlwaysReduceJudgeMaximallyReduces() throws Exception {
139138
final File jsonFile = getShaderJobReady();
140139
final File emptyFile = temporaryFolder.newFile();
141140
emptyFile.setExecutable(true);
142-
Reduce.mainHelper(new String[]{
141+
GlslReduce.mainHelper(new String[]{
143142
jsonFile.getAbsolutePath(),
144143
"CUSTOM",
145144
"--custom_judge",

server/src/main/java/com/graphicsfuzz/server/GraphicsFuzzServerCommandDispatcher.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package com.graphicsfuzz.server;
1818

1919
import com.graphicsfuzz.common.util.ParseTimeoutException;
20-
import com.graphicsfuzz.reducer.tool.Reduce;
20+
import com.graphicsfuzz.reducer.tool.GlslReduce;
2121
import com.graphicsfuzz.server.thrift.FuzzerServiceManager.Iface;
2222
import com.graphicsfuzz.shadersets.RunShaderFamily;
2323
import com.graphicsfuzz.shadersets.ShaderDispatchException;
@@ -38,8 +38,8 @@ public void dispatchCommand(List<String> command, Iface fuzzerServiceManager)
3838
fuzzerServiceManager
3939
);
4040
break;
41-
case "reduce":
42-
Reduce.mainHelper(
41+
case "glsl-reduce":
42+
GlslReduce.mainHelper(
4343
command.subList(1, command.size()).toArray(new String[0]),
4444
fuzzerServiceManager
4545
);

server/src/main/java/com/graphicsfuzz/server/webui/WebUi.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ private void reduce(HttpServletRequest request, HttpServletResponse response)
13391339
response.setContentType("text/html");
13401340

13411341
final List<String> args = new ArrayList<>();
1342-
args.add("reduce");
1342+
args.add("glsl-reduce");
13431343
final String shaderJobFilePath = request.getParameter("shader_path");
13441344
args.add(shaderJobFilePath);
13451345
final String reductionType = request.getParameter("reduction_type");
@@ -1440,7 +1440,7 @@ private void reduceReference(String shaderJobFilePath, String worker) {
14401440
new File(WebUiConstants.WORKER_DIR + "/" + worker + "/" + shaderset + "_exp",
14411441
"reference.info.json");
14421442
List<String> args = new ArrayList<>();
1443-
args.add("reduce");
1443+
args.add("glsl-reduce");
14441444
args.add(referenceShaderJobFile.getPath());
14451445
args.add("IDENTICAL");
14461446
args.add("--output");

tester/src/test/java/com/graphicsfuzz/tester/ReducerUnitTest.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.graphicsfuzz.common.ast.expr.VariableIdentifierExpr;
2727
import com.graphicsfuzz.common.glslversion.ShadingLanguageVersion;
2828
import com.graphicsfuzz.common.tool.PrettyPrinterVisitor;
29+
import com.graphicsfuzz.reducer.tool.GlslReduce;
2930
import com.graphicsfuzz.util.Constants;
3031
import com.graphicsfuzz.common.transformreduce.GlslShaderJob;
3132
import com.graphicsfuzz.common.transformreduce.ShaderJob;
@@ -60,7 +61,6 @@
6061
import com.graphicsfuzz.reducer.reductionopportunities.ReductionOpportunities;
6162
import com.graphicsfuzz.reducer.reductionopportunities.ReducerContext;
6263
import com.graphicsfuzz.reducer.tool.RandomFileJudge;
63-
import com.graphicsfuzz.reducer.tool.Reduce;
6464
import java.io.File;
6565
import java.io.FileNotFoundException;
6666
import java.io.FileOutputStream;
@@ -425,7 +425,7 @@ public void testBasicReduction() throws Exception {
425425

426426
int numSteps = 20;
427427

428-
Reduce.mainHelper(new String[] {
428+
GlslReduce.mainHelper(new String[] {
429429
referenceJson.getAbsolutePath(),
430430
"--swiftshader",
431431
"IDENTICAL",
@@ -442,7 +442,7 @@ public void testBasicReduction() throws Exception {
442442

443443
while (new File(output, Constants.REDUCTION_INCOMPLETE).exists()) {
444444
numSteps += 5;
445-
Reduce.mainHelper(new String[] {
445+
GlslReduce.mainHelper(new String[] {
446446
referenceJson.getAbsolutePath(),
447447
"--swiftshader",
448448
"IDENTICAL",
@@ -481,7 +481,7 @@ public void testConditionForContinuingReduction() throws Exception {
481481
final File output = temporaryFolder.newFolder();
482482
// This should throw a FileNotFoundException, because REDUCTION_INCOMPLETE
483483
// will not be present.
484-
Reduce.mainHelper(new String[] { "--swiftshader", "--continue_previous_reduction",
484+
GlslReduce.mainHelper(new String[] { "--swiftshader", "--continue_previous_reduction",
485485
json.getAbsolutePath(), "--output",
486486
output.getAbsolutePath(), "NO_IMAGE" }, null);
487487
}
@@ -505,7 +505,7 @@ public void checkReductionIsFinite() throws Exception {
505505
reference, referenceImage, false);
506506
assertEquals(0, referenceResult.res);
507507
final File output = temporaryFolder.newFolder();
508-
Reduce.mainHelper(new String[] {
508+
GlslReduce.mainHelper(new String[] {
509509
referenceJson.getAbsolutePath(),
510510
"--swiftshader",
511511
"IDENTICAL",

0 commit comments

Comments
 (0)