mirror of
https://github.com/ohwgiles/laminar.git
synced 2024-10-27 20:34:20 +00:00
fix minor compile warnings
This commit is contained in:
parent
09a208ebeb
commit
d6be7f5079
@ -195,7 +195,7 @@ int main(int argc, char** argv) {
|
|||||||
return EXIT_BAD_ARGUMENT;
|
return EXIT_BAD_ARGUMENT;
|
||||||
}
|
}
|
||||||
if(char* pipeNum = getenv("__LAMINAR_SETENV_PIPE")) {
|
if(char* pipeNum = getenv("__LAMINAR_SETENV_PIPE")) {
|
||||||
write(atoi(pipeNum), argv[2], strlen(argv[2]));
|
LSYSCALL(write(atoi(pipeNum), argv[2], strlen(argv[2])));
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Must be run from within a laminar job\n");
|
fprintf(stderr, "Must be run from within a laminar job\n");
|
||||||
return EXIT_BAD_ARGUMENT;
|
return EXIT_BAD_ARGUMENT;
|
||||||
|
@ -780,7 +780,7 @@ bool Laminar::handleBadgeRequest(std::string job, std::string &badge) {
|
|||||||
const char* gradient1 = (rs == RunState::SUCCESS) ? "#2aff4d" : "#ff2a2a";
|
const char* gradient1 = (rs == RunState::SUCCESS) ? "#2aff4d" : "#ff2a2a";
|
||||||
const char* gradient2 = (rs == RunState::SUCCESS) ? "#24b43c" : "#b42424";
|
const char* gradient2 = (rs == RunState::SUCCESS) ? "#24b43c" : "#b42424";
|
||||||
char* svg = NULL;
|
char* svg = NULL;
|
||||||
asprintf(&svg,
|
if(asprintf(&svg,
|
||||||
R"x(
|
R"x(
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="%d" height="20">
|
<svg xmlns="http://www.w3.org/2000/svg" width="%d" height="20">
|
||||||
<clipPath id="clip">
|
<clipPath id="clip">
|
||||||
@ -800,7 +800,9 @@ R"x(
|
|||||||
<rect x="%d" width="%d" height="20" fill="url(#status)"/>
|
<rect x="%d" width="%d" height="20" fill="url(#status)"/>
|
||||||
<text x="%d" y="14" fill="#000">%s</text>
|
<text x="%d" y="14" fill="#000">%s</text>
|
||||||
</g>
|
</g>
|
||||||
</svg>)x", jobNameWidth+statusWidth, jobNameWidth+statusWidth, gradient1, gradient2, jobNameWidth, jobNameWidth/2+1, job.data(), jobNameWidth, statusWidth, jobNameWidth+statusWidth/2, status.data());
|
</svg>)x", jobNameWidth+statusWidth, jobNameWidth+statusWidth, gradient1, gradient2, jobNameWidth, jobNameWidth/2+1, job.data(), jobNameWidth, statusWidth, jobNameWidth+statusWidth/2, status.data()) < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
badge = svg;
|
badge = svg;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
///
|
///
|
||||||
/// Copyright 2019 Oliver Giles
|
/// Copyright 2019-2020 Oliver Giles
|
||||||
///
|
///
|
||||||
/// This file is part of Laminar
|
/// This file is part of Laminar
|
||||||
///
|
///
|
||||||
@ -89,7 +89,7 @@ Leader::Leader(kj::AsyncIoContext &ioContext, kj::Filesystem &fs, const char *jo
|
|||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
pipe(setEnvPipe);
|
LSYSCALL(pipe(setEnvPipe));
|
||||||
auto event = ioContext.lowLevelProvider->wrapInputFd(setEnvPipe[0], kj::LowLevelAsyncIoProvider::TAKE_OWNERSHIP);
|
auto event = ioContext.lowLevelProvider->wrapInputFd(setEnvPipe[0], kj::LowLevelAsyncIoProvider::TAKE_OWNERSHIP);
|
||||||
auto buffer = kj::heapArrayBuilder<char>(1024);
|
auto buffer = kj::heapArrayBuilder<char>(1024);
|
||||||
tasks.add(readEnvPipe(event, buffer.asPtr().begin()).attach(kj::mv(event), kj::mv(buffer)));
|
tasks.add(readEnvPipe(event, buffer.asPtr().begin()).attach(kj::mv(event), kj::mv(buffer)));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
///
|
///
|
||||||
/// Copyright 2015-2018 Oliver Giles
|
/// Copyright 2015-2020 Oliver Giles
|
||||||
///
|
///
|
||||||
/// This file is part of Laminar
|
/// This file is part of Laminar
|
||||||
///
|
///
|
||||||
@ -152,8 +152,8 @@ kj::Promise<RunState> Run::start(uint buildNum, std::shared_ptr<Context> ctx, co
|
|||||||
// enough. Instead, we'll just exec ourselves and handle that in laminard's
|
// enough. Instead, we'll just exec ourselves and handle that in laminard's
|
||||||
// main() by calling leader_main()
|
// main() by calling leader_main()
|
||||||
char* procName;
|
char* procName;
|
||||||
asprintf(&procName, "{laminar} %s:%d", name.data(), buildNum);
|
if(asprintf(&procName, "{laminar} %s:%d", name.data(), buildNum) > 0)
|
||||||
execl("/proc/self/exe", procName, NULL); // does not return
|
execl("/proc/self/exe", procName, NULL); // does not return
|
||||||
_exit(EXIT_FAILURE);
|
_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
///
|
///
|
||||||
/// Copyright 2019 Oliver Giles
|
/// Copyright 2019-2020 Oliver Giles
|
||||||
///
|
///
|
||||||
/// This file is part of Laminar
|
/// This file is part of Laminar
|
||||||
///
|
///
|
||||||
@ -19,15 +19,17 @@
|
|||||||
#ifndef LAMINAR_FIXTURE_H_
|
#ifndef LAMINAR_FIXTURE_H_
|
||||||
#define LAMINAR_FIXTURE_H_
|
#define LAMINAR_FIXTURE_H_
|
||||||
|
|
||||||
#include <capnp/rpc-twoparty.h>
|
|
||||||
#include <gtest/gtest.h>
|
|
||||||
#include "laminar.capnp.h"
|
#include "laminar.capnp.h"
|
||||||
#include "eventsource.h"
|
#include "eventsource.h"
|
||||||
#include "tempdir.h"
|
#include "tempdir.h"
|
||||||
#include "laminar.h"
|
#include "laminar.h"
|
||||||
|
#include "log.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
|
#include <capnp/rpc-twoparty.h>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
class LaminarFixture : public ::testing::Test {
|
class LaminarFixture : public ::testing::Test {
|
||||||
public:
|
public:
|
||||||
LaminarFixture() {
|
LaminarFixture() {
|
||||||
@ -108,7 +110,7 @@ public:
|
|||||||
StringMap parseFromString(kj::StringPtr content) {
|
StringMap parseFromString(kj::StringPtr content) {
|
||||||
char tmp[16] = "/tmp/lt.XXXXXX";
|
char tmp[16] = "/tmp/lt.XXXXXX";
|
||||||
int fd = mkstemp(tmp);
|
int fd = mkstemp(tmp);
|
||||||
write(fd, content.begin(), content.size());
|
LSYSCALL(write(fd, content.begin(), content.size()));
|
||||||
close(fd);
|
close(fd);
|
||||||
StringMap map = parseConfFile(tmp);
|
StringMap map = parseConfFile(tmp);
|
||||||
unlink(tmp);
|
unlink(tmp);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
///
|
///
|
||||||
/// Copyright 2018 Oliver Giles
|
/// Copyright 2018-2020 Oliver Giles
|
||||||
///
|
///
|
||||||
/// This file is part of Laminar
|
/// This file is part of Laminar
|
||||||
///
|
///
|
||||||
@ -19,6 +19,8 @@
|
|||||||
#ifndef LAMINAR_TEMPDIR_H_
|
#ifndef LAMINAR_TEMPDIR_H_
|
||||||
#define LAMINAR_TEMPDIR_H_
|
#define LAMINAR_TEMPDIR_H_
|
||||||
|
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
#include <kj/filesystem.h>
|
#include <kj/filesystem.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
@ -37,7 +39,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
static kj::Path mkdtemp() {
|
static kj::Path mkdtemp() {
|
||||||
char dir[] = "/tmp/laminar-test-XXXXXX";
|
char dir[] = "/tmp/laminar-test-XXXXXX";
|
||||||
::mkdtemp(dir);
|
LASSERT(::mkdtemp(dir) != nullptr, "mkdtemp failed");
|
||||||
return kj::Path::parse(&dir[1]);
|
return kj::Path::parse(&dir[1]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
///
|
///
|
||||||
/// Copyright 2018 Oliver Giles
|
/// Copyright 2018-2020 Oliver Giles
|
||||||
///
|
///
|
||||||
/// This file is part of Laminar
|
/// This file is part of Laminar
|
||||||
///
|
///
|
||||||
@ -16,8 +16,9 @@
|
|||||||
/// You should have received a copy of the GNU General Public License
|
/// You should have received a copy of the GNU General Public License
|
||||||
/// along with Laminar. If not, see <http://www.gnu.org/licenses/>
|
/// along with Laminar. If not, see <http://www.gnu.org/licenses/>
|
||||||
///
|
///
|
||||||
#include <gtest/gtest.h>
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
#include "log.h"
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
class ConfTest : public ::testing::Test {
|
class ConfTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
@ -30,7 +31,7 @@ protected:
|
|||||||
}
|
}
|
||||||
void parseConf(std::string conf) {
|
void parseConf(std::string conf) {
|
||||||
lseek(fd, SEEK_SET, 0);
|
lseek(fd, SEEK_SET, 0);
|
||||||
write(fd, conf.data(), conf.size());
|
LSYSCALL(write(fd, conf.data(), conf.size()));
|
||||||
cfg = parseConfFile(tmpFile);
|
cfg = parseConfFile(tmpFile);
|
||||||
}
|
}
|
||||||
StringMap cfg;
|
StringMap cfg;
|
||||||
|
Loading…
Reference in New Issue
Block a user