Skip to content

Commit ce88807

Browse files
author
Minggang Wang
committed
Revert "Use new strategy to verify message transmitting (#250)"
This reverts commit 5bf3230.
1 parent 5bf3230 commit ce88807

17 files changed

+1350
-717
lines changed

scripts/compile_cpp.js

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,40 +19,22 @@ const os = require('os');
1919
const path = require('path');
2020
const child = require('child_process');
2121

22-
// var platform = os.platform();
22+
var platform = os.platform();
2323
var rootDir = path.dirname(__dirname);
2424
var testCppDir = path.join(rootDir, 'test', 'cpp');
2525

26-
function getExecutable(input) {
27-
if (os.platform() === 'win32')
28-
return input + '.exe';
29-
30-
return input;
31-
}
32-
33-
var publisher = getExecutable('publisher_msg');
34-
var subscription = getExecutable('subscription_msg');
35-
var listener = getExecutable('listener');
36-
var client = getExecutable('add_two_ints_client');
37-
38-
function getExecutablePath(input) {
39-
var releaseDir = '';
40-
if (os.platform() === 'win32')
41-
releaseDir = 'Release';
42-
43-
return path.join(rootDir, 'build', 'cpp_nodes', releaseDir, input);
44-
}
45-
46-
var publisherPath = getExecutablePath(publisher);
47-
var subscriptionPath = getExecutablePath(subscription);
48-
var listenerPath = getExecutablePath(listener);
49-
var clientPath = getExecutablePath(client);
26+
var publisher = (platform === 'win32') ? 'publisher_msg.exe' : 'publisher_msg';
27+
var subscription = (platform === 'win32') ? 'subscription_msg.exe' : 'subscription_msg';
5028

29+
var publisherPath = path.join(rootDir, 'build', 'cpp_nodes',
30+
(platform === 'win32') ? 'Release' : '', publisher);
31+
var subscriptionPath = path.join(rootDir, 'build', 'cpp_nodes',
32+
(platform === 'win32') ? 'Release' : '', subscription);
5133

5234
function copyFile(platform, srcFile, destFile) {
5335
// eslint-disable-next-line
5436
if (!fs.existsSync(destFile)) {
55-
if (os.platform() === 'win32') {
37+
if (platform === 'win32') {
5638
child.spawn('cmd.exe', ['/c', `copy ${srcFile} ${destFile}`]);
5739
} else {
5840
child.spawn('sh', ['-c', `cp ${srcFile} ${destFile}`]);
@@ -62,18 +44,16 @@ function copyFile(platform, srcFile, destFile) {
6244

6345
function copyAll(fileList, dest) {
6446
fileList.forEach((file) => {
65-
copyFile(os.platform(), file, path.join(dest, path.basename(file)));
47+
copyFile(platform, file, path.join(dest, path.basename(file)));
6648
});
6749
}
6850

6951
// eslint-disable-next-line
70-
if (!fs.existsSync(publisherPath) && !fs.existsSync(subscriptionPath) &&
71-
// eslint-disable-next-line
72-
!fs.existsSync(listenerPath) && !fs.existsSync(clientPath)) {
52+
if (!fs.existsSync(publisherPath) && !fs.existsSync(subscriptionPath)) {
7353
var compileProcess = child.spawn('ament', ['build', testCppDir, '--skip-install']);
7454
compileProcess.on('close', (code) => {
75-
copyAll([publisherPath, subscriptionPath, listenerPath, clientPath], testCppDir);
55+
copyAll([publisherPath, subscriptionPath], testCppDir);
7656
});
7757
} else {
78-
copyAll([publisherPath, subscriptionPath, , listenerPath, clientPath], testCppDir);
58+
copyAll([publisherPath, subscriptionPath], testCppDir);
7959
}

test/blacklist.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Linux": [],
3-
"Darwin": [],
4-
"Windows_NT": []
2+
"Linux": ["test-cross-lang.js", "test-interactive.js", "test-multi-nodes.js"],
3+
"Darwin": ["test-cross-lang.js", "test-interactive.js", "test-multi-nodes.js"],
4+
"Windows_NT": ["test-cross-lang.js", "test-interactive.js", "test-multi-nodes.js"]
55
}

test/client_setup.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@ const rclnodejs = require('../index.js');
1919
rclnodejs.init().then(function() {
2020
var node = rclnodejs.createNode('client');
2121
const AddTwoInts = 'example_interfaces/srv/AddTwoInts';
22-
const Int8 = 'std_msgs/msg/Int8';
2322
var client = node.createClient(AddTwoInts, 'add_two_ints');
2423
const request = {
2524
a: 1,
2625
b: 2,
2726
};
28-
var publisher = node.createPublisher(Int8, 'back_add_two_ints');
29-
client.sendRequest(request, (response) => {
30-
publisher.publish(response.sum);
27+
client.sendRequest(request, function(response) {
28+
process.stdout.write(response.sum.toString());
3129
});
3230
rclnodejs.spin(node);
3331

test/cpp/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,3 @@ endfunction()
3131

3232
custom_executable(publisher_msg)
3333
custom_executable(subscription_msg)
34-
custom_executable(listener)
35-
custom_executable(add_two_ints_client)

test/cpp/add_two_ints_client.cpp

Lines changed: 0 additions & 109 deletions
This file was deleted.

test/cpp/listener.cpp

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)