Skip to content

Commit f0383de

Browse files
committed
Script and doc changes based on Windows testing (#181)
1 parent 699e819 commit f0383de

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+530
-85
lines changed

build/travis/1-install-deps-travis.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ GITHUB_RELEASE_TOOL_VERSION="v1.1.0"
2626

2727
if [ "$(uname)" == "Darwin" ];
2828
then
29-
brew install python3 unzip wget
29+
brew install python3 unzip
3030
GITHUB_RELEASE_TOOL_ARCH="darwin_amd64"
3131
ANDROID_HOST_PLATFORM="darwin"
3232
fi
@@ -35,19 +35,20 @@ if [ "$(uname)" == "Linux" ];
3535
then
3636
sudo add-apt-repository ppa:deadsnakes/ppa -y
3737
sudo apt-get update -q
38-
sudo apt-get install python3.6 unzip wget -y
38+
sudo apt-get install python3.6 unzip -y
3939
GITHUB_RELEASE_TOOL_ARCH="linux_amd64"
4040
ANDROID_HOST_PLATFORM="linux"
4141
fi
4242

4343

4444
pushd /data/bin
45-
wget "https://github.com/${GITHUB_RELEASE_TOOL_USER}/github-release/releases/download/${GITHUB_RELEASE_TOOL_VERSION}/github-release_${GITHUB_RELEASE_TOOL_VERSION}_${GITHUB_RELEASE_TOOL_ARCH}.tar.gz"
45+
curl -Lo "github-release_${GITHUB_RELEASE_TOOL_VERSION}_${GITHUB_RELEASE_TOOL_ARCH}.tar.gz" \
46+
"https://github.com/${GITHUB_RELEASE_TOOL_USER}/github-release/releases/download/${GITHUB_RELEASE_TOOL_VERSION}/github-release_${GITHUB_RELEASE_TOOL_VERSION}_${GITHUB_RELEASE_TOOL_ARCH}.tar.gz"
4647
tar xf "github-release_${GITHUB_RELEASE_TOOL_VERSION}_${GITHUB_RELEASE_TOOL_ARCH}.tar.gz"
4748
popd
4849

4950

50-
# Android SDK (ANDROID_HOST_PLATFORM must be set to linux, darwin, or windows).
51+
# Android SDK (ANDROID_HOST_PLATFORM must be set to linux, darwin, or windows, and ANDROID_HOME must be set to some directory).
5152

5253
ANDROID_TOOLS_FILENAME="sdk-tools-${ANDROID_HOST_PLATFORM}-4333796.zip"
5354
ANDROID_NDK_FILENAME="android-ndk-r18b-${ANDROID_HOST_PLATFORM}-x86_64.zip"
@@ -57,23 +58,23 @@ mkdir -p "${ANDROID_HOME}"
5758
pushd "${ANDROID_HOME}"
5859

5960
# Android: "sdk-tools.zip" "tools":
60-
wget -q "http://dl.google.com/android/repository/${ANDROID_TOOLS_FILENAME}"
61+
curl -qo "${ANDROID_TOOLS_FILENAME}" "http://dl.google.com/android/repository/${ANDROID_TOOLS_FILENAME}"
6162
unzip -q "${ANDROID_TOOLS_FILENAME}"
6263
rm "${ANDROID_TOOLS_FILENAME}"
6364

6465
# Android "android-ndk.zip" "ndk-bundle"
65-
wget -q "https://dl.google.com/android/repository/${ANDROID_NDK_FILENAME}"
66+
curl -qo "${ANDROID_NDK_FILENAME}" "https://dl.google.com/android/repository/${ANDROID_NDK_FILENAME}"
6667
unzip -q "${ANDROID_NDK_FILENAME}"
6768
rm "${ANDROID_NDK_FILENAME}"
6869
mv android-ndk-*/ ndk-bundle
6970

7071
# Android "platform-tools.zip" "platform-tools"
71-
wget -q "https://dl.google.com/android/repository/${ANDROID_PLATFORM_TOOLS_FILENAME}"
72+
curl -qo "${ANDROID_PLATFORM_TOOLS_FILENAME}" "https://dl.google.com/android/repository/${ANDROID_PLATFORM_TOOLS_FILENAME}"
7273
unzip -q "${ANDROID_PLATFORM_TOOLS_FILENAME}"
7374
rm "${ANDROID_PLATFORM_TOOLS_FILENAME}"
7475

7576
# Android "platforms" and "build-tools"
76-
echo y | sdkmanager \
77+
echo y | tools/bin/sdkmanager \
7778
"platforms;android-26" \
7879
"build-tools;28.0.2"
7980

build/travis/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# Copyright 2018 The GraphicsFuzz Project Authors
44
#

build/travis/check_headers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# Copyright 2018 The GraphicsFuzz Project Authors
44
#
@@ -33,6 +33,8 @@ def exclude_dirname(f: str):
3333
"__pycache__",
3434
".externalNativeBuild",
3535
".mvn",
36+
"cmake-build-debug",
37+
"cmake-build-release",
3638

3739
]
3840

build/travis/licenses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# Copyright 2018 The GraphicsFuzz Project Authors
44
#

build/travis/release.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# Copyright 2018 The GraphicsFuzz Project Authors
44
#

docs/android-notes.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ by following our
2020
[continuous integration script](../build/travis/1-install-deps-travis.sh);
2121
the download of the Android SDK starts about halfway down.
2222
You may need to set some environment variables as specified in the comments.
23+
On Windows, you can use the Git Bash shell.
2324

24-
Ensure that the `ANDROID_HOME=/path/to/android-sdk` and `ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle` environment variables are set;
25-
you may need to open IntelliJ IDEA from the terminal depending on how
25+
Ensure that the `ANDROID_HOME=/path/to/android-sdk` and `ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle` environment variables are set.
26+
If using IntelliJ and/or Android Studio,
27+
you may need to open your IDE from the terminal depending on how
2628
you set the environment variables.
2729

2830
You should also add the `android-sdk/platform-tools` directory

docs/glsl-fuzz-develop.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ page](glsl-fuzz-releases.md).
1515
* [Maven](https://maven.apache.org/)
1616
* [Python 3.5+](https://www.python.org/)
1717

18-
* For our Android workers: [Android SDK & NDK](https://developer.android.com/studio/#command-tools)
18+
* For our Android workers: [Android SDK & NDK](android-notes.md)
1919
* For the Vulkan desktop worker: [Vulkan SDK](https://vulkan.lunarg.com/sdk/home)
2020

2121
> Our *workers* are applications that run on the device you wish to test;
@@ -89,6 +89,9 @@ or read the [walkthrough for a brief overview of using all tools
8989

9090
#### Android
9191

92+
Ensure that the `ANDROID_HOME=/path/to/android-sdk` and
93+
`ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle` environment variables are set.
94+
9295
```shell
9396
cd vulkan-worker
9497
./gradlew assembleDebug

docs/glsl-fuzz-generate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ glsl-generate --seed 0 samples/donors samples/100 10 "100" family_100 work/shade
135135
# Generate some "Vulkan-compatible" GLSL version 300 es shaders that can be translated to SPIR-V for Vulkan testing.
136136
glsl-generate --seed 0 --generate_uniform_bindings --max_uniforms 10 samples/donors samples/310es 10 "310 es" family_vulkan work/shaderfamilies
137137

138-
# The lines above will take approx. 1-2 minutes each, and will generate a shader family for every
138+
# Each line above will take approx. 1 minute, and will generate a shader family for every
139139
# shader in samples/300es or samples/100:
140140
ls work/shaderfamilies
141141

docs/glsl-fuzz-walkthrough.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ glsl-fuzz is a testing framework for automatically finding and simplifying bugs
44
by generating, running, and reducing GLSL shaders.
55

66
In this walkthrough, we will briefly demonstrate most features of glsl-fuzz from start to finish, including our browser-based UI.
7+
We present commands assuming a Linux/Mac environment,
8+
but Windows users can adapt the commands or
9+
use the Git Bash shell.
710

811
The use of `glsl-fuzz` can be roughly split into the following steps:
912

@@ -68,6 +71,11 @@ You will need to install Python 3.5 or higher, either:
6871
* By downloading from [https://www.python.org/downloads/](https://www.python.org/downloads/).
6972
* By downloading and installing some other Python 3 distribution.
7073

74+
For Windows: most recent installers of Python
75+
add `py`, a Python launcher, to your path.
76+
Our scripts attempt to use `py -3 SCRIPT.py` to
77+
execute `SCRIPT.py` using Python 3.5+.
78+
7179
### `adb`
7280

7381
The Vulkan worker for Android requires that `adb` is on your path.
@@ -164,7 +172,7 @@ glsl-generate --seed 0 samples/100 samples/donors 10 "100" family_100 work/shade
164172
# Generate some "Vulkan-compatible" GLSL version 300 es shaders that can be translated to SPIR-V for Vulkan testing.
165173
glsl-generate --seed 0 --generate-uniform-bindings --max-uniforms 10 samples/310es samples/donors 10 "310 es" family_vulkan work/shaderfamilies
166174

167-
# The lines above will take approx. 1-2 minutes each, and will generate a shader family for every
175+
# Each line above will take approx. 1 minute, and will generate a shader family for every
168176
# shader in samples/300es or samples/100:
169177
ls work/shaderfamilies
170178

@@ -388,8 +396,10 @@ the `vulkan-worker-android` app running on the Android device.
388396
> re-run SPIR-V shaders on the device.
389397
> [We describe this in more detail below](#running-shaders-from-the-command-line).
390398
391-
The intermediate files are saved to the current directory.
392-
For example:
399+
The intermediate files are saved in the current directory under
400+
a `WORKERNAME/` directory.
401+
For example, we might have a worker name of `pixel3`
402+
and so under `pixel3/` we will see:
393403

394404
```
395405
test.vert # The default GLSL vertex shader.

docs/glsl-reduce-walkthrough.md

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@ glsl-reduce is a tool for automatically reducing a GLSL shader with respect to a
55
In this walkthrough, we will use a mock shader compiler bug to demonstrate how
66
to use glsl-reduce in action.
77

8+
## Requirements
9+
10+
**Summary:** the latest release zip, Java 8+, and Python 3.5+.
11+
12+
### Release zip
13+
814
We will be using the latest release zip `graphicsfuzz-1.0.zip`.
915
You can download this from the [releases page](glsl-fuzz-releases.md)
10-
or [build it from source](glsl-fuzz-build.md).
16+
or [build it from source](glsl-fuzz-develop.md).
1117

1218
Add the following directories to your path:
1319

@@ -17,13 +23,15 @@ Add the following directories to your path:
1723
* `graphicsfuzz-1.0/bin/Mac`
1824
* `graphicsfuzz-1.0/bin/Windows`
1925

20-
The `graphicsfuzz-1.0/` directory is the unzipped graphicsfuzz release.
26+
The `graphicsfuzz-1.0/` directory is the unzipped release.
2127
If building from source, this directory can be found at `graphicsfuzz/target/graphicsfuzz-1.0/`.
2228

29+
### Java 8+
30+
2331
You will also need to install the latest version of the Java 8 Development Kit,
2432
either:
2533

26-
* From your system's package manager. E.g. `sudo apt-get install openjdk-8-jdk`.
34+
* From your system's package manager. E.g. Ubuntu: `sudo apt-get install openjdk-8-jdk`.
2735
* By [downloading and installing Oracle's binary distribution](http://www.oracle.com/technetwork/java/javase/downloads/index.html) (look for Java SE 8uXXX then the JDK link).
2836
* By downloading and installing some other OpenJDK binary distribution for your platform.
2937

@@ -34,16 +42,32 @@ java -version
3442
# Output: openjdk version "1.8.0_181"
3543
```
3644

45+
### Python 3.5+
46+
47+
You will need to install Python 3.5 or higher, either:
48+
49+
* From your system's package manager. E.g. Ubuntu: `sudo apt-get install python3`.
50+
* By downloading from [https://www.python.org/downloads/](https://www.python.org/downloads/).
51+
* By downloading and installing some other Python 3 distribution.
52+
53+
For Windows: most recent installers of Python
54+
add `py`, a Python launcher, to your path.
55+
Our scripts attempt to use `py -3 SCRIPT.py` to
56+
execute `SCRIPT.py` using Python 3.5+.
57+
58+
3759
## glsl-reduce in action
3860

39-
We'll start by illustrating a mock shader compiler bug. We present commands assuming a Linux/Mac environment, but they should be easy to adapt to a Windows setting.
61+
We'll start by illustrating a mock shader compiler bug. We present commands assuming a Linux/Mac environment,
62+
but Windows users can adapt the commands or
63+
use the Git Bash shell.
4064

4165
```sh
42-
# Copy the sample shaders into the current directory:
66+
# Copy the sample files into the current directory:
4367
cp -r graphicsfuzz-1.0/examples/glsl-reduce-walkthrough .
4468

4569
# Run the fake shader compiler on the fragment shader file:
46-
python glsl-reduce-walkthrough/fake_compiler.py glsl-reduce-walkthrough/colorgrid_modulo.frag
70+
glsl-reduce-walkthrough/fake_compiler glsl-reduce-walkthrough/colorgrid_modulo.frag
4771

4872
# Output:
4973
# Fatal error: too much indexing.
@@ -53,7 +77,7 @@ python glsl-reduce-walkthrough/fake_compiler.py glsl-reduce-walkthrough/colorgri
5377
Our fake compiler fails to compile the valid shader because it cannot handle shaders
5478
with a lot of indexing. Thus, we have found a compiler bug.
5579

56-
> Take a look at `fake_compiler.py` if you want to see why the fake compiler generates this error
80+
> Take a look at `glsl-reduce-walkthrough/fake_compiler.py` if you want to see why the fake compiler generates this error
5781
> message for the shader. This is not important for understanding how to use the reducer.
5882
5983
Let's now use glsl-reduce to get a much smaller shader that causes the compiler to fail with this error:
@@ -72,7 +96,7 @@ glsl-reduce glsl-reduce-walkthrough/colorgrid_modulo.json ./glsl-reduce-walkthro
7296
# <lots of messages about the reducer's progress>
7397

7498
# Confirm that the reduced fragment shader file still reproduces the issue
75-
python glsl-reduce-walkthrough/fake_compiler.py reduction_results/colorgrid_modulo_reduced_final.frag
99+
glsl-reduce-walkthrough/fake_compiler reduction_results/colorgrid_modulo_reduced_final.frag
76100

77101
# Output:
78102
# Fatal error: too much indexing.
@@ -131,7 +155,7 @@ cat slipped_reduction_results/colorgrid_modulo_reduced_final.frag
131155
# <a shader with an empty main>
132156

133157
# Does it still give us the fatal error?
134-
python glsl-reduce-walkthrough/fake_compiler.py reduction_results/colorgrid_modulo_reduced_final.frag
158+
glsl-reduce-walkthrough/fake_compiler slipped_reduction_results/colorgrid_modulo_reduced_final.frag
135159

136160
# Output:
137161
# Internal error: something went wrong inlining 'floor'.

0 commit comments

Comments
 (0)