Add Getting Started

sha512sum 2024-11-07 15:22:25 +00:00
parent 8d25ecdcb7
commit 33032d85df

56
Getting-Started.md Normal file

@ -0,0 +1,56 @@
# Table of Content <!-- omit in toc -->
- [How to build](#how-to-build)
- [How to test](#how-to-test)
## How to build
Larra dev environment provides a dev container environment with all required tools, libraries and configured (locally hosted) ejabberd server.
Build steps:
- Install **docker**, **docker-compose** and **VS Code** and open a project in Dev Container
- Build project using Cmake
- Using VS Code Task: "Build Debug GCC"
- Manually
```bash
mkdir -p build && cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON .. && cmake --build . --parallel `nproc`
```
## How to test
### Unit tests
- Build project with **-DENABLE_TESTS=ON** to enable GTests
- Launch tests
```bash
./build/larra_xmpp_tests
```
### Module tests
- Launch ejabber server by opening a project in a Dev Container environment or start it manually
- Launch client
```bash
/workspaces/larra/build/examples/output/connect
```
Make sure that larra client with your change is able to pass all tests without errors. For now it supports only **Plain Authentication** check.
Successful Plain Authentication logs:
```bash
[info] [connect.cpp] Connecting client...
[info] [printer_stream.hpp] Writing data to stream: <?xml version="1.0"?><stream:stream xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" from="test1@localhost" to="localhost" version="1.0" xml:lang="en">
[info] [printer_stream.hpp] Data writing completed: 172
[info] [printer_stream.hpp] Reading data from stream:
[info] [printer_stream.hpp] Readed data: <?xml version='1.0'?><stream:stream id='3964734841065883241' version='1.0' xml:lang='en' xmlns:stream='http://etherx.jabber.org/streams' to='test1@localhost' from='localhost' xmlns='jabber:client'>
[info] [printer_stream.hpp] Reading data from stream:
[info] [printer_stream.hpp] Readed data: <stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism></mechanisms><register xmlns='http://jabber.org/features/iq-register'/></stream:features>
[info] [printer_stream.hpp] Writing data to stream: <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN">AHRlc3QxAHRlc3Qx</auth>
[info] [printer_stream.hpp] Data writing completed: 88
[info] [printer_stream.hpp] Reading data from stream:
[info] [printer_stream.hpp] Readed data: <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
[info] [connect.cpp] Done connecting client!
```