5151
5252#include "raylib.h"
5353
54- #include <stdlib.h> // Required for: NULL, calloc(), free()
5554#include <stdio.h> // Required for: rename(), remove()
5655#include <string.h> // Required for: strcmp(), strcpy()
56+ #include <stdlib.h> // Required for: NULL, calloc(), free()
5757
5858#define SUPPORT_LOG_INFO
5959#if defined(SUPPORT_LOG_INFO ) //&& defined(_DEBUG)
@@ -1517,7 +1517,7 @@ int main(int argc, char *argv[])
15171517 TextFormat ("%s/%s/%s.original.c" , exBasePath , exCategory , exName ));
15181518 char * srcText = LoadFileText (TextFormat ("%s/%s/%s.c" , exBasePath , exCategory , exName ));
15191519
1520- #define BUILD_TESTING_WEB
1520+ // #define BUILD_TESTING_WEB
15211521#if defined(BUILD_TESTING_WEB )
15221522 static const char * mainReplaceText =
15231523 "#include <stdio.h>\n"
@@ -1620,8 +1620,9 @@ int main(int argc, char *argv[])
16201620 exBasePath , exCategory , exName , exBasePath , exCategory , exName ));
16211621 #else
16221622 LOG ("INFO: [%s] Building example for PLATFORM_DESKTOP (Host: POSIX)\n" , exName );
1623- system (TextFormat ("make -C %s %s/%s PLATFORM=PLATFORM_DESKTOP -B" , exBasePath , exCategory , exName ));
1624- #endif
1623+ system (TextFormat ("make -C %s %s/%s PLATFORM=PLATFORM_DESKTOP -B > %s/%s/logs/%s.build.log 2>&1" ,
1624+ exBasePath , exCategory , exName , exBasePath , exCategory , exName ));
1625+ #endif
16251626 // Restore original source code before continue
16261627 FileCopy (TextFormat ("%s/%s/%s.original.c" , exBasePath , exCategory , exName ),
16271628 TextFormat ("%s/%s/%s.c" , exBasePath , exCategory , exName ));
@@ -1630,7 +1631,7 @@ int main(int argc, char *argv[])
16301631 // STEP 3: Run example with required arguments
16311632 // NOTE: Not easy to retrieve process return value from system(), it's platform dependant
16321633 ChangeDirectory (TextFormat ("%s/%s" , exBasePath , exCategory ));
1633- system (TextFormat ("%s --frames 2 > logs/%s.log" , exName , exName ));
1634+ system (TextFormat ("./ %s --frames 2 > logs/%s.log" , exName , exName ));
16341635#endif
16351636 }
16361637 } break ;
@@ -1712,7 +1713,9 @@ int main(int argc, char *argv[])
17121713 char * * exTestLogLines = LoadTextLines (exTestLog , & exTestLogLinesCount );
17131714 for (int k = 0 ; k < exTestLogLinesCount ; k ++ )
17141715 {
1715- if (TextFindIndex (exTestLogLines [k ], "WARNING: GL: NPOT" ) >= 0 ) continue ; // Ignore warning
1716+ #if defined(BUILD_TESTING_WEB )
1717+ if (TextFindIndex (exTestLogLines [k ], "WARNING: GL: NPOT" ) >= 0 ) continue ; // Ignore web-specific warning
1718+ #endif
17161719 if (TextFindIndex (exTestLogLines [k ], "WARNING" ) >= 0 ) testing [i ].warnings ++ ;
17171720 }
17181721 UnloadTextLines (exTestLogLines , exTestLogLinesCount );
@@ -1842,6 +1845,7 @@ int main(int argc, char *argv[])
18421845 printf (" rename <old_examples_name> <new_example_name> : Rename an existing example\n" );
18431846 printf (" remove <example_name> : Remove an existing example\n" );
18441847 printf (" build <example_name> : Build example for Desktop and Web platforms\n" );
1848+ printf (" test <example_name> : Build and Test example for Desktop and Web platforms\n" );
18451849 printf (" validate : Validate examples collection, generates report\n" );
18461850 printf (" update : Validate and update examples collection, generates report\n\n" );
18471851 printf ("OPTIONS:\n\n" );
0 commit comments