commit ace12cd8b0d0f47d68207ad86d9cf93170c26493
parent 7f43c5cf1b15342685e9ebab55e7f75e9eff1c50
Author: Remy Noulin <loader2x@gmail.com>
Date: Thu, 17 Oct 2019 07:41:43 +0200
propagate exit code from test (spm test) to spm exit code
src/sheepy.c | 4 ++--
src/spm.c | 14 +++++++++-----
2 files changed, 11 insertions(+), 7 deletions(-)
Diffstat:
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/sheepy.c b/src/sheepy.c
@@ -154,7 +154,7 @@ int MAIN(int ARGC, char** ARGV) {
dum = catS(libsheepyDir, "/libsheepy.a");
if (!fileExists(dum)) {
- printf(BLD RED "Libsheepy not found: %s not accessible" RST "\nIf libsheepy in another directory, set LIBSHEEPY to libsheepy path, for example: export LIBSHEEPY=/home/$USER/libsheepy/release/\n", dum); {
+ printf("\n" BLD RED "Libsheepy not found: %s not accessible" RST "\nIf libsheepy in another directory, set LIBSHEEPY to libsheepy path, for example: export LIBSHEEPY=/home/$USER/libsheepy/release/\n", dum); {
free(dum);
XFAILURE
}
@@ -353,7 +353,7 @@ int MAIN(int ARGC, char** ARGV) {
// check if libsheepyMemcheck exists
dum = catS(libsheepyDir, "/libsheepyMemcheck.a");
if (!fileExists(dum)) {
- printf(BLD RED "LibsheepyMemcheck not found: %s not accessible" RST "\nIf libsheepy in another directory, set LIBSHEEPY to libsheepy path, for example: export LIBSHEEPY=/home/$USER/libsheepy/release/\nAnd compile libsheepyMemcheck with buildMemcheck.sh in the libsheepy git repo\n", dum); {
+ printf("\n" BLD RED "LibsheepyMemcheck not found: %s not accessible" RST "\nIf libsheepy in another directory, set LIBSHEEPY to libsheepy path, for example: export LIBSHEEPY=/home/$USER/libsheepy/release/\nand compile libsheepyMemcheck with buildMemcheck.sh in the libsheepy git repo\n", dum); {
terminateG(bin);
free(dum);
XFAILURE
diff --git a/src/spm.c b/src/spm.c
@@ -65,7 +65,7 @@ void installAPackage(bool isGlobal, smallDictt *cfgD, smallStringt *o, bool pigz
void compilePackage(char *name, bool isGlobal, smallDictt *cfgD, char *currentVersion);
smallDictt *loadYML(char *path);
bool installDependencies(bool isGlobal, smallDictt *cfgD, smallDictt *d, const char *name);
-void testPackage(smallDictt *cfgD, smallDictt *packageyml);
+int testPackage(smallDictt *cfgD, smallDictt *packageyml);
void memcheckPackage(smallDictt *cfgD, smallDictt *packageyml);
void listAllPackages(smallDictt *cfgD, smallArrayt *options);
void showPackage(smallDictt *cfgD, smallStringt *o);
@@ -756,8 +756,9 @@ int MAIN(int ARGC, char** ARGV) {
XFAILURE
}
smallDictt *d = loadYML(PACKAGE);
- testPackage(cfgD, d);
+ int exitCode = testPackage(cfgD, d);;
terminateG(d);
+ exit(exitCode);
}
if (params.memcheck) {
@@ -1243,7 +1244,8 @@ bool installDependencies(bool isGlobal, smallDictt *cfgD, smallDictt *d, const c
return(r);
}
-void testPackage(smallDictt *cfgD, smallDictt *packageyml) {
+int testPackage(smallDictt *cfgD, smallDictt *packageyml) {
+ int exitCode = 1;;
if (hasG(packageyml, "testBin")) {
char *bin = getNDupG(packageyml, rtChar, "testBin");
@@ -1269,15 +1271,17 @@ void testPackage(smallDictt *cfgD, smallDictt *packageyml) {
if (getG(cfgD, rtBool, "print_compile_commands")) {
printf("%s\n", bin);
}
- system(bin);
+ exitCode = command(bin);;
if (getG(cfgD, rtBool, "print_compile_commands")) {
printf("sheepy -d %s\n", getG(packageyml, rtChar, "testBin"));
}
systemf("sheepy -d %s", getG(packageyml, rtChar, "testBin"));
-}
}
+ return(exitCode);
+}
+
void memcheckPackage(smallDictt *cfgD, smallDictt *packageyml) {
if (!hasG(packageyml, "memcheckBin")) {