Skip to content

Porting legacy tests to new integration-test infra (part 1...) #2294

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 42 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
3e55331
Moved out from legacy some TryBuild* integration tests
cmaglie Sep 3, 2023
7e0899c
Ported sketch_with_config integration tests out of legacy
cmaglie Sep 2, 2023
8a62b12
Ported sketch_no_functions integration tests out of legacy
cmaglie Sep 2, 2023
b064f2a
Ported sketch_with_backup_files integration tests out of legacy
cmaglie Sep 2, 2023
8513196
Ported sketch_with_old_lib integration tests out of legacy
cmaglie Sep 2, 2023
f0c9848
Ported sketch_with_subfolders integration tests out of legacy
cmaglie Sep 2, 2023
4e582a4
Ported sketch_with_class integration tests out of legacy
cmaglie Sep 2, 2023
7597e88
Simplified integrationtest of preprocessor
cmaglie Sep 2, 2023
cce795e
Ported sketch_with_typename integration tests out of legacy
cmaglie Sep 2, 2023
e819701
Ported sketch_with_namespace integration tests out of legacy
cmaglie Sep 2, 2023
9e3a3fe
Ported sketch_with_default_args integration tests out of legacy
cmaglie Sep 3, 2023
3533da2
Ported sketch_with_inline_function_args integration tests out of legacy
cmaglie Sep 3, 2023
6c472c0
Ported sketch_with_function_signature_inside_ifdef integration tests …
cmaglie Sep 3, 2023
297235b
Ported sketch_with_usbcon integration tests out of legacy
cmaglie Sep 3, 2023
a3f2fa1
Ported sketch_with_const integration tests out of legacy
cmaglie Sep 3, 2023
fd7b7e1
Ported sketch_with_templates_and_shift integration tests out of legacy
cmaglie Sep 3, 2023
9d22542
Ported sketch eol_processing integration tests out of legacy
cmaglie Sep 3, 2023
d8f64de
Ported SketchWithIfdef integration tests out of legacy
cmaglie Sep 3, 2023
4cf01fa
Ported sketch_with_ifdef integration tests out of legacy
cmaglie Sep 3, 2023
3e96ac6
Ported Bridge integration tests out of legacy
cmaglie Sep 3, 2023
2fda19f
Ported more Bridge integration tests out of legacy
cmaglie Sep 3, 2023
ca21942
Ported even more Bridge integration tests out of legacy
cmaglie Sep 3, 2023
e447ba9
Better subtesting categorization
cmaglie Sep 3, 2023
3b354ad
Ported yet another Bridge integration tests out of legacy
cmaglie Sep 3, 2023
d66c875
Ported Balanduino integration tests out of legacy
cmaglie Sep 3, 2023
1866cd8
Ported CharWithEscapedDoubleQuote integration tests out of legacy
cmaglie Sep 3, 2023
c0941c0
Ported IncludeBetweenMultilineComment integration tests out of legacy
cmaglie Sep 3, 2023
f4f6f25
Ported LineContinuations integration tests out of legacy
cmaglie Sep 3, 2023
c5dc578
Ported StringWithComment integration tests out of legacy
cmaglie Sep 3, 2023
b73e411
Ported SketchWithStruct integration tests out of legacy
cmaglie Sep 3, 2023
1de6112
Ported SketchNoFunctionsTwoFiles integration tests out of legacy
cmaglie Sep 4, 2023
f88ee92
Ported SketchWithClassAndMethodSubstring integration tests out of legacy
cmaglie Sep 4, 2023
dac334e
Ported SketchThatChecksIfSPIHasTransactions integration tests out of …
cmaglie Sep 4, 2023
8bc29c7
Ported sketch_with_dependend_libraries integration tests out of legacy
cmaglie Sep 4, 2023
8f0a4ca
Ported sketch_with_function_pointer integration tests out of legacy
cmaglie Sep 4, 2023
180dba1
Ported sketch_usbhost integration tests out of legacy
cmaglie Sep 4, 2023
e4d2845
Removed sketch1 from try_build* test
cmaglie Sep 4, 2023
4500280
Ported sketch9 integration tests out of legacy
cmaglie Sep 4, 2023
c954899
Removing no more used functions
cmaglie Sep 4, 2023
0206ffc
Ported USBHost test
cmaglie Sep 4, 2023
a8f1d88
Removed no more useful test from legacy
cmaglie Sep 4, 2023
c4f9601
Removed no more needed tests
cmaglie Sep 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
631 changes: 631 additions & 0 deletions internal/integrationtest/compile_4/compile_test.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <Arduino.h>
#line 1 {{QuoteCppString .sketch.MainFile}}
#line 1 {{QuoteCppString .sketchMainFile}}
/*
* The code is released under the GNU General Public License.
* Developed by Kristian Lauszus, TKJ Electronics 2013
Expand Down Expand Up @@ -87,11 +87,11 @@ WII Wii(&Btd); // The Wii library can communicate with Wiimotes and the Nunchuck
// This can also be done using the Android or Processing application
#endif

#line 88 {{QuoteCppString .sketch.MainFile}}
#line 88 {{QuoteCppString .sketchMainFile}}
void setup();
#line 204 {{QuoteCppString .sketch.MainFile}}
#line 204 {{QuoteCppString .sketchMainFile}}
void loop();
#line 88 {{QuoteCppString .sketch.MainFile}}
#line 88 {{QuoteCppString .sketchMainFile}}
void setup() {
/* Initialize UART */
Serial.begin(115200);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
/*
Arduino Yún Bridge example

This example for the Arduino Yún shows how to use the
Bridge library to access the digital and analog pins
on the board through REST calls. It demonstrates how
you can create your own API when using REST style
calls through the browser.

Possible commands created in this shetch:

"/arduino/digital/13" -> digitalRead(13)
"/arduino/digital/13/1" -> digitalWrite(13, HIGH)
"/arduino/analog/2/123" -> analogWrite(2, 123)
"/arduino/analog/2" -> analogRead(2)
"/arduino/mode/13/input" -> pinMode(13, INPUT)
"/arduino/mode/13/output" -> pinMode(13, OUTPUT)

This example code is part of the public domain

http://www.arduino.cc/en/Tutorial/Bridge

*/

#include <Bridge.h>
#include <BridgeServer.h>
#include <BridgeClient.h>

// Listen to the default port 5555, the Yún webserver
// will forward there all the HTTP requests you send
BridgeServer server;

void setup() {
// Bridge startup
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
Bridge.begin();
digitalWrite(13, HIGH);

// Listen for incoming connection only from localhost
// (no one from the external network could connect)
server.listenOnLocalhost();
server.begin();
}

void loop() {
// Get clients coming from server
BridgeClient client = server.accept();

// There is a new client?
if (client) {
// Process request
process(client);

// Close connection and free resources.
client.stop();
}

delay(50); // Poll every 50ms
}

void process(BridgeClient client) {
// read the command
String command = client.readStringUntil('/');

// is "digital" command?
if (command == "digital") {
digitalCommand(client);
}

// is "analog" command?
if (command == "analog") {
analogCommand(client);
}

// is "mode" command?
if (command == "mode") {
modeCommand(client);
}
}

void digitalCommand(BridgeClient client) {
int pin, value;

// Read pin number
pin = client.parseInt();

// If the next character is a '/' it means we have an URL
// with a value like: "/digital/13/1"
if (client.read() == '/') {
value = client.parseInt();
digitalWrite(pin, value);
} else {
value = digitalRead(pin);
}

// Send feedback to client
client.print(F("Pin D"));
client.print(pin);
client.print(F(" set to "));
client.println(value);

// Update datastore key with the current pin value
String key = "D";
key += pin;
Bridge.put(key, String(value));
}

void analogCommand(BridgeClient client) {
int pin, value;

// Read pin number
pin = client.parseInt();

// If the next character is a '/' it means we have an URL
// with a value like: "/analog/5/120"
if (client.read() == '/') {
// Read value and execute command
value = client.parseInt();
analogWrite(pin, value);

// Send feedback to client
client.print(F("Pin D"));
client.print(pin);
client.print(F(" set to analog "));
client.println(value);

// Update datastore key with the current pin value
String key = "D";
key += pin;
Bridge.put(key, String(value));
} else {
// Read analog pin
value = analogRead(pin);

// Send feedback to client
client.print(F("Pin A"));
client.print(pin);
client.print(F(" reads analog "));
client.println(value);

// Update datastore key with the current pin value
String key = "A";
key += pin;
Bridge.put(key, String(value));
}
}

void modeCommand(BridgeClient client) {
int pin;

// Read pin number
pin = client.parseInt();

// If the next character is not a '/' we have a malformed URL
if (client.read() != '/') {
client.println(F("error"));
return;
}

String mode = client.readStringUntil('\r');

if (mode == "input") {
pinMode(pin, INPUT);
// Send feedback to client
client.print(F("Pin D"));
client.print(pin);
client.print(F(" configured as INPUT!"));
return;
}

if (mode == "output") {
pinMode(pin, OUTPUT);
// Send feedback to client
client.print(F("Pin D"));
client.print(pin);
client.print(F(" configured as OUTPUT!"));
return;
}

client.print(F("error: invalid mode "));
client.print(mode);
}


Loading