提交 d59bc07a authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Improve worker build system to separate both mediasoup-worker and mediasoup-worker-test targets:

- `make Release/Debug` builds mediasoup-worker.
- `make test` builds mediasoup-worker-test (in Debug mode).
- `gulp test-worker` runs the mediasoup-worker-test binary.
上级 c03210af
......@@ -17,18 +17,22 @@ Builds a more verbose mediasoup and less optimized worker binary at `worker/out/
Check the meaning of these macros in the [Logger.h](worker/include/Logger.h) header file.
In order to instruct the **mediasoup** Node.js module to use the `Debug` mediasoup worker binary, an environment variable must be set before running the Node.js application or the internal test units:
In order to instruct the **mediasoup** Node.js module to use the `Debug` mediasoup worker binary, an environment variable must be set before running the Node.js application or the JavaScript test units:
```bash
$ MEDIASOUP_BUILDTYPE=Debug node myapp.js
```
Or, in order to run the internal test units with the `Debug` mediasoup worker:
Or, in order to run the JavaScript test units with the `Debug` mediasoup worker:
```bash
$ MEDIASOUP_BUILDTYPE=Debug gulp test-debug
```
### `make test`
Builds the `mediasoup-worker-test` test unit binary at `worker/out/Debug/` in `Debug` mode.
### `make xcode`
Builds a Xcode project for the mediasoup worker subproject.
......@@ -66,11 +70,15 @@ Reads **mediasoup** [media capabilities](https://github.com/ibc/mediasoup/blob/m
### `gulp test`
Run the internal [test units](test/).
Run the JavaScript [test units](test/).
### `gulp test-debug`
Run the internal [test units](test/) in a more verbose fashion. Note however that running this task does not use the `Debug` mediasoup worker binary. If you wish to use it, set the `MEDIASOUP_BUILDTYPE` environment variable as explained above.
Run the JavaScript [test units](test/) in a more verbose fashion. Note however that running this task does not use the `Debug` mediasoup worker binary. If you wish to use it, set the `MEDIASOUP_BUILDTYPE` environment variable as explained above.
### `gulp test-worker`
Run the mediasoup worker [test units](worker/test/). Take into account that, before running this task, the mediasoup worker test unit binary must be built by running `make test` (as explained above).
### `gulp`
......
.PHONY: default Release Debug clean clean-all
#
# make tasks for mediasoup-worker.
#
.PHONY: default Release Debug test xcode clean clean-all
default: Release
Release:
cd worker && ./scripts/configure.py
cd worker && ./scripts/configure.py -R mediasoup-worker
$(MAKE) BUILDTYPE=Release -C worker/out
Debug:
cd worker && ./scripts/configure.py
cd worker && ./scripts/configure.py -R mediasoup-worker
$(MAKE) BUILDTYPE=Debug -C worker/out
test:
cd worker && ./scripts/configure.py -R mediasoup-worker-test
$(MAKE) BUILDTYPE=Debug -C worker/out
xcode:
......@@ -16,10 +24,15 @@ xcode:
clean:
$(RM) -rf worker/out/Release/mediasoup-worker
$(RM) -rf worker/out/Release/obj.target/mediasoup-worker
$(RM) -rf worker/out/Release/mediasoup-worker-test
$(RM) -rf worker/out/Release/obj.target/mediasoup-worker-test
$(RM) -rf worker/out/Debug/mediasoup-worker
$(RM) -rf worker/out/Debug/obj.target/mediasoup-worker
$(RM) -rf worker/out/Debug/mediasoup-worker-test
$(RM) -rf worker/out/Debug/obj.target/mediasoup-worker-test
clean-all:
$(RM) -rf worker/out
$(RM) -rf worker/mediasoup-worker.xcodeproj
$(RM) -rf worker/mediasoup-worker-test.xcodeproj
$(RM) -rf worker/deps/*/*.xcodeproj
......@@ -62,4 +62,12 @@ gulp.task('test-debug', shell.task(
}
));
gulp.task('test-worker', shell.task(
[ 'worker/out/Debug/mediasoup-worker-test' ],
{
env : { DEBUG: '*WARN* *ERROR* *ABORT*' },
verbose : true
}
));
gulp.task('default', gulp.series('lint'));
......@@ -14,7 +14,7 @@
* MS_TRACE()
*
* Logs the current method/function if the current source file defines the
* MS_LOG_TRACE macro.
* MS_LOG_TRACE macro and the current debug level is "debug".
*
* MS_DEBUG_TAG(tag, ...)
* MS_WARN_TAG(tag, ...)
......@@ -104,16 +104,22 @@ public:
#define MS_TRACE() \
do \
{ \
int ms_logger_written = std::snprintf(Logger::buffer, MS_LOGGER_BUFFER_SIZE, "D(trace) " _MS_LOG_STR, _MS_LOG_ARG); \
Logger::channel->SendLog(Logger::buffer, ms_logger_written); \
if (LogLevel::LOG_DEBUG == Settings::configuration.logLevel) \
{ \
int ms_logger_written = std::snprintf(Logger::buffer, MS_LOGGER_BUFFER_SIZE, "D(trace) " _MS_LOG_STR, _MS_LOG_ARG); \
Logger::channel->SendLog(Logger::buffer, ms_logger_written); \
} \
} \
while (0)
#define MS_TRACE_STD() \
do \
{ \
std::fprintf(stdout, "(trace) " _MS_LOG_STR _MS_LOG_SEPARATOR_CHAR_STD, _MS_LOG_ARG); \
std::fflush(stdout); \
if (LogLevel::LOG_DEBUG == Settings::configuration.logLevel) \
{ \
std::fprintf(stdout, "(trace) " _MS_LOG_STR _MS_LOG_SEPARATOR_CHAR_STD, _MS_LOG_ARG); \
std::fflush(stdout); \
} \
} \
while (0)
#else
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论