Skip to content

Commit a4a6812

Browse files
committed
REXM: REVIEWED: Testing report generation
1 parent 9efe127 commit a4a6812

File tree

1 file changed

+47
-20
lines changed

1 file changed

+47
-20
lines changed

tools/rexm/rexm.c

Lines changed: 47 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,11 @@ int main(int argc, char *argv[])
14791479
memset(exCategory, 0, 32);
14801480
strncpy(exCategory, exName, TextFindIndex(exName, "_"));
14811481

1482+
// Skip some examples from building
1483+
if ((strcmp(exName, "others") == 0) ||
1484+
(strcmp(exName, "core_custom_logging") == 0) ||
1485+
(strcmp(exName, "core_window_should_close") == 0)) continue;
1486+
14821487
LOG("INFO: [%i/%i] Testing example: [%s]\n", i + 1, exBuildListCount, exName);
14831488

14841489
// Steps to follow
@@ -1500,7 +1505,7 @@ int main(int argc, char *argv[])
15001505
TextFormat("%s/%s/%s.original.c", exBasePath, exCategory, exName));
15011506
char *srcText = LoadFileText(TextFormat("%s/%s/%s.c", exBasePath, exCategory, exName));
15021507

1503-
#define BUILD_TESTING_WEB
1508+
//#define BUILD_TESTING_WEB
15041509
#if defined(BUILD_TESTING_WEB)
15051510
static const char *mainReplaceText =
15061511
"#include <stdio.h>\n"
@@ -1549,7 +1554,7 @@ int main(int argc, char *argv[])
15491554
// Build: raylib.com/examples/<category>/<category>_example_name.js
15501555
#if defined(_WIN32)
15511556
LOG("INFO: [%s] Building example for PLATFORM_WEB (Host: Win32)\n", exName);
1552-
system(TextFormat("mingw32-make -C %s -f Makefile.Web %s/%s PLATFORM=PLATFORM_WEB -B", exBasePath, exCategory, exName));
1557+
system(TextFormat("mingw32-make -C %s -f Makefile.Web %s/%s PLATFORM=PLATFORM_WEB -B > %s/%s/logs/%s.build.log 2>&1", exBasePath, exCategory, exName));
15531558
#else
15541559
LOG("INFO: [%s] Building example for PLATFORM_WEB (Host: POSIX)\n", exName);
15551560
system(TextFormat("make -C %s -f Makefile.Web %s/%s PLATFORM=PLATFORM_WEB -B", exBasePath, exCategory, exName));
@@ -1561,9 +1566,11 @@ int main(int argc, char *argv[])
15611566

15621567
// STEP 3: Run example on browser
15631568
ChangeDirectory(TextFormat("%s/%s", exBasePath, exCategory));
1564-
system("start python -m http.server 8080");
1569+
system("start python -m http.server 8080"); // TODO: Init localhost just once!
15651570
system(TextFormat("start explorer \"http:\\localhost:8080/%s.html", exName));
15661571

1572+
// NOTE: Example .log is automatically downloaded into system Downloads directory on browser-example exectution
1573+
15671574
#else // BUILD_TESTING_DESKTOP
15681575

15691576
static const char *mainReplaceText =
@@ -1621,6 +1628,7 @@ int main(int argc, char *argv[])
16211628

16221629
for (int k = 0, index = 0; k < exTestBuildLogLinesCount; k++)
16231630
{
1631+
// Checking compilation warnings generated
16241632
if (TextFindIndex(exTestBuildLogLines[k], "warning:") >= 0) testing[i].buildwarns++;
16251633
}
16261634

@@ -1664,7 +1672,8 @@ int main(int argc, char *argv[])
16641672
//-----------------------------------------------------------------------------------------------------
16651673
/*
16661674
Columns:
1667-
- [WARN] : WARNING messages count
1675+
- [CWARN] : Compilation WARNING messages
1676+
- [LWARN] : Log WARNING messages count
16681677
- [INIT] : Initialization
16691678
- [CLOSE] : Closing
16701679
- [ASSETS] : Assets loading
@@ -1673,9 +1682,9 @@ int main(int argc, char *argv[])
16731682
- [FONT] : Font default initialization
16741683
- [TIMER] : Timer initialization
16751684
1676-
| **EXAMPLE NAME** | [WARN] | [INIT] | [CLOSE] | [ASSETS] | [RLGL] | [PLAT] | [FONT] | [TIMER] |
1677-
|:---------------------------------|:------:|:------:|:-------:|:--------:|:------:|:------:|:------:|:-------:|
1678-
| core_basic window | 0 | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
1685+
| **EXAMPLE NAME** | [CWARN] | [LWARN] | [INIT] | [CLOSE] | [ASSETS] | [RLGL] | [PLAT] | [FONT] | [TIMER] |
1686+
|:---------------------------------|:-------:|:-------:|:------:|:-------:|:--------:|:------:|:------:|:------:|:-------:|
1687+
| core_basic window | 0 | 0 | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
16791688
*/
16801689
LOG("INFO: [examples_testing.md] Generating examples testing report...\n");
16811690

@@ -1695,8 +1704,8 @@ int main(int argc, char *argv[])
16951704
repIndex += sprintf(report + repIndex, " - [FONT] : Font default initialization\n");
16961705
repIndex += sprintf(report + repIndex, " - [TIMER] : Timer initialization\n```\n");
16971706

1698-
repIndex += sprintf(report + repIndex, "| **EXAMPLE NAME** | [WARN] | [INIT] | [CLOSE] | [ASSETS] | [RLGL] | [PLAT] | [FONT] | [TIMER] |\n");
1699-
repIndex += sprintf(report + repIndex, "|:---------------------------------|:------:|:------:|:-------:|:--------:|:------:|:------:|:------:|:-------:|\n");
1707+
repIndex += sprintf(report + repIndex, "| **EXAMPLE NAME** | [CWARN] | [LWARN] | [INIT] | [CLOSE] | [ASSETS] | [RLGL] | [PLAT] | [FONT] | [TIMER] |\n");
1708+
repIndex += sprintf(report + repIndex, "|:---------------------------------|:-------:|:-------:|:------:|:-------:|:--------:|:------:|:------:|:------:|:-------:|\n");
17001709

17011710
/*
17021711
TESTING_FAIL_INIT = 1 << 0, // Initialization (InitWindow()) -> "INFO: DISPLAY: Device initialized successfully"
@@ -1709,23 +1718,41 @@ int main(int argc, char *argv[])
17091718
*/
17101719
for (int i = 0; i < exBuildListCount; i++)
17111720
{
1712-
if (testing[i].status > 0)
1721+
if ((testing[i].buildwarns > 0) || (testing[i].warnings > 0) || (testing[i].status > 0))
17131722
{
1714-
repIndex += sprintf(report + repIndex, "| %-32s | %i | %s | %s | %s | %s | %s | %s | %s |\n",
1715-
exBuildList[i], testing[i].warnings,
1716-
(testing[i].status & TESTING_FAIL_INIT)? "✔" : "❌",
1717-
(testing[i].status & TESTING_FAIL_CLOSE)? "✔" : "❌",
1718-
(testing[i].status & TESTING_FAIL_ASSETS)? "✔" : "❌",
1719-
(testing[i].status & TESTING_FAIL_RLGL)? "✔" : "❌",
1720-
(testing[i].status & TESTING_FAIL_PLATFORM)? "✔" : "❌",
1721-
(testing[i].status & TESTING_FAIL_FONT)? "✔" : "❌",
1722-
(testing[i].status & TESTING_FAIL_TIMER)? "✔" : "❌");
1723+
repIndex += sprintf(report + repIndex, "| %-32s | %i | %i | %s | %s | %s | %s | %s | %s | %s |\n",
1724+
exBuildList[i],
1725+
testing[i].buildwarns,
1726+
testing[i].warnings,
1727+
(testing[i].status & TESTING_FAIL_INIT)? "❌" : "✔",
1728+
(testing[i].status & TESTING_FAIL_CLOSE)? "❌" : "✔",
1729+
(testing[i].status & TESTING_FAIL_ASSETS)? "❌" : "✔",
1730+
(testing[i].status & TESTING_FAIL_RLGL)? "❌" : "✔",
1731+
(testing[i].status & TESTING_FAIL_PLATFORM)? "❌" : "✔",
1732+
(testing[i].status & TESTING_FAIL_FONT)? "❌" : "✔",
1733+
(testing[i].status & TESTING_FAIL_TIMER)? "❌" : "✔");
17231734
}
17241735
}
17251736

17261737
repIndex += sprintf(report + repIndex, "\n");
17271738

1728-
SaveFileText(TextFormat("%s/../tools/rexm/reports/%s", exBasePath, "examples_testing_windows.md"), report);
1739+
#if defined(PLATFORM_DRM)
1740+
const char *osName = "drm";
1741+
#elif defined(PLATFORM_WEB)
1742+
const char *osName = "web";
1743+
#elif defined(PLATFORM_DESKTOP)
1744+
#if defined(_WIN32)
1745+
const char *osName = "windows";
1746+
#elif defined(__linux__)
1747+
const char *osName = "linux";
1748+
#elif defined(__FreeBSD__)
1749+
const char *osName = "freebsd";
1750+
#elif defined(__APPLE__)
1751+
const char *osName = "macos";
1752+
#endif // Desktop OSs
1753+
#endif
1754+
SaveFileText(TextFormat("%s/../tools/rexm/reports/examples_testing_%s.md", exBasePath, osName), report);
1755+
17291756
RL_FREE(report);
17301757
//-----------------------------------------------------------------------------------------------------
17311758

0 commit comments

Comments
 (0)