Skip to content
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

test: add test-fs-read-buffer-to-string-fail as pass and flaky to all platforms #14495

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,7 @@ Server.prototype.listen = function() {
self.once('listening', lastArg);
}

var port = toNumber(arguments[0]);
var port = typeof arguments[0] === 'undefined' ? 0 : toNumber(arguments[0]);

// The third optional argument is the backlog size.
// When the ip is omitted it can be the second argument.
Expand Down
8 changes: 4 additions & 4 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,13 @@ static X509_NAME *cnnic_ev_name =

static Mutex* mutexes;

const char* const root_certs[] = {
static const char* const root_certs[] = {
#include "node_root_certs.h" // NOLINT(build/include_order)
};

std::string extra_root_certs_file; // NOLINT(runtime/string)
static std::string extra_root_certs_file; // NOLINT(runtime/string)

X509_STORE* root_cert_store;
std::vector<X509*> root_certs_vector;
static X509_STORE* root_cert_store;

// Just to generate static methods
template class SSLWrap<TLSWrap>;
Expand Down Expand Up @@ -710,6 +709,7 @@ static int X509_up_ref(X509* cert) {


static X509_STORE* NewRootCertStore() {
static std::vector<X509*> root_certs_vector;
if (root_certs_vector.empty()) {
for (size_t i = 0; i < arraysize(root_certs); i++) {
BIO* bp = NodeBIO::NewFixed(root_certs[i], strlen(root_certs[i]));
Expand Down
2 changes: 0 additions & 2 deletions src/node_crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ enum CheckResult {

extern int VerifyCallback(int preverify_ok, X509_STORE_CTX* ctx);

extern X509_STORE* root_cert_store;

extern void UseExtraCaCerts(const std::string& file);

// Forward declaration
Expand Down
1 change: 1 addition & 0 deletions test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ prefix parallel
# sample-test : PASS,FLAKY

[true] # This section applies to all platforms
test-fs-read-buffer-tostring-fail : PASS,FLAKY

[$system==win32]

Expand Down
35 changes: 35 additions & 0 deletions test/parallel/test-net-listen-port-option.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,38 @@ net.Server().listen({ port: '' + common.PORT }, close);
net.Server().listen({ port: port }, common.fail);
}, /invalid listen argument/i);
});

// Repeat the tests, passing port as an argument, which validates somewhat
// differently.

net.Server().listen(undefined, close);
net.Server().listen('0', close);

// 'nan', skip, treated as a path, not a port
//'+Infinity', skip, treated as a path, not a port
//'-Infinity' skip, treated as a path, not a port

// 4.x treats these as 0, but 6.x treats them as invalid numbers.
[
-1,
123.456,
0x10000,
1 / 0,
-1 / 0,
].forEach(function(port) {
assert.throws(function() {
net.Server().listen(port, common.fail);
}, /"port" argument must be >= 0 and < 65536/i);
});

// null is treated as 0
net.Server().listen(null, close);

// false/true are converted to 0/1, arguably a bug, but fixing would be
// semver-major. Note that true fails because ports that low can't be listened
// on by unprivileged processes.
net.Server().listen(false, close);

net.Server().listen(true).on('error', common.mustCall(function(err) {
assert.strictEqual(err.code, 'EACCES');
}));