Skip to content

Commit 834265b

Browse files
committed
Create a shell script to run the smoketest. pi4j-test/assets/runSmoketest.sh
1 parent 7d59cbe commit 834265b

File tree

4 files changed

+122
-0
lines changed

4 files changed

+122
-0
lines changed

pi4j-test/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ Testing the full Pi4J library is hard because it requires real hardware devices
66

77
The `src/main/java/com/pi4j/test/Main.java` class verifies that the providers can be loaded and used. The use is very basic, but just enough to know it worked.
88

9+
## Build and Run
10+
11+
In top directory
12+
``` text
13+
mvn clean install -Pnative
14+
cd pi4j-test/target/distribution
15+
./runSmoketest.sh
16+
```
17+
918
Usage parms:
1019

1120
```text

pi4j-test/assets/runSmoketest.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
4+
#
5+
#
6+
#
7+
# #%L
8+
# **********************************************************************
9+
# ORGANIZATION : Pi4J
10+
# PROJECT : Pi4J :: LIBRARY :: Java Library (CORE)
11+
# FILENAME : runSmoketest.sh
12+
#
13+
# This file is part of the Pi4J project. More information about
14+
# this project can be found here: https://pi4j.com/
15+
# **********************************************************************
16+
#
17+
# Licensed under the Apache License, Version 2.0 (the "License");
18+
# you may not use this file except in compliance with the License.
19+
# You may obtain a copy of the License at
20+
#
21+
# http://www.apache.org/licenses/LICENSE-2.0
22+
#
23+
# Unless required by applicable law or agreed to in writing, software
24+
# distributed under the License is distributed on an "AS IS" BASIS,
25+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26+
# See the License for the specific language governing permissions and
27+
# limitations under the License.
28+
# #L%
29+
#
30+
#
31+
#
32+
33+
34+
java -classpath ./*:../classes com.pi4j.test.Main "$@"
35+

pi4j-test/pom.xml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,55 @@
193193
</arguments>
194194
</configuration>
195195
</plugin>
196+
<plugin>
197+
<groupId>org.apache.maven.plugins</groupId>
198+
<artifactId>maven-antrun-plugin</artifactId>
199+
<version>${maven-antrun-plugin.version}</version>
200+
<executions>
201+
<execution>
202+
<id>copy-assetsPYSH</id>
203+
<phase>package</phase>
204+
<configuration>
205+
<target>
206+
<mkdir dir="${project.build.directory}/distribution"/>
207+
<copy todir="${project.build.directory}/distribution" overwrite="true" flatten="true">
208+
<fileset dir="assets" includes="*.py"> </fileset>
209+
</copy>
210+
<copy todir="${project.build.directory}/distribution" overwrite="true" flatten="true">
211+
<fileset dir="assets" includes="*.sh"> </fileset>
212+
</copy>
213+
<chmod dir="${project.build.directory}/distribution" perm="ugo+rx" includes="**/*.py"/>
214+
<chmod dir="${project.build.directory}/distribution" perm="ugo+rx" includes="**/*.sh"/>
215+
</target>
216+
</configuration>
217+
<goals>
218+
<goal>run</goal>
219+
</goals>
220+
</execution>
221+
</executions>
222+
</plugin>
223+
<plugin>
224+
<groupId>org.apache.maven.plugins</groupId>
225+
<artifactId>maven-dependency-plugin</artifactId>
226+
<version>${maven-dependency-plugin.version}</version>
227+
<executions>
228+
<execution>
229+
<id>copy-dependencies</id>
230+
<phase>process-sources</phase>
231+
<goals>
232+
<goal>copy-dependencies</goal>
233+
</goals>
234+
<configuration>
235+
<outputDirectory>${project.build.directory}/distribution</outputDirectory>
236+
<includeScope>runtime</includeScope>
237+
<excludeTransitive>false</excludeTransitive>
238+
<overWriteReleases>false</overWriteReleases>
239+
<overWriteSnapshots>true</overWriteSnapshots>
240+
<overWriteIfNewer>true</overWriteIfNewer>
241+
</configuration>
242+
</execution>
243+
</executions>
244+
</plugin>
196245
</plugins>
197246
</build>
198247

pi4j-test/src/main/java/com/pi4j/test/Main.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
/*
2+
*
3+
*
4+
* #%L
5+
* **********************************************************************
6+
* ORGANIZATION : Pi4J
7+
* PROJECT : Pi4J :: LIBRARY :: Java Library (CORE)
8+
* FILENAME : Main.java
9+
*
10+
* This file is part of the Pi4J project. More information about
11+
* this project can be found here: https://pi4j.com/
12+
* **********************************************************************
13+
*
14+
* Licensed under the Apache License, Version 2.0 (the "License");
15+
* you may not use this file except in compliance with the License.
16+
* You may obtain a copy of the License at
17+
*
18+
* http://www.apache.org/licenses/LICENSE-2.0
19+
*
20+
* Unless required by applicable law or agreed to in writing, software
21+
* distributed under the License is distributed on an "AS IS" BASIS,
22+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23+
* See the License for the specific language governing permissions and
24+
* limitations under the License.
25+
* #L%
26+
*
27+
*
28+
*/
29+
130
package com.pi4j.test;/*-
231
* #%L
332
* **********************************************************************

0 commit comments

Comments
 (0)