apache / couchdb

Seamless multi-master syncing database with an intuitive HTTP/JSON API, designed for reliability
https://couchdb.apache.org/
Apache License 2.0
6.17k stars 1.03k forks source link

Missing `weatherreport-test` makefile target on Windows #4376

Open big-r81 opened 1 year ago

big-r81 commented 1 year ago

Description

The make target weatherreport-test is missing on Windows and needs to be backported from the *nix makefile target.

Steps to Reproduce

Run this on Windows:

PS C:\relax\couchdb> make -f Makefile.win weatherreport-test

Output:

make: *** No rule to make target 'weatherreport-test'.  Stop.

Expected Behaviour

Should run the test like the makefile target on *nix:

[ * ] Running cluster setup ... ok
[ * ] Exec command bin/weatherreport --etc dev/lib/node1/etc --level error ... No diagnostic messages to report.

Your Environment

big-r81 commented 1 year ago

Update:

Discussion with Robert on Slack:

weatherreport was built with Linux in mind and nothing else afaicr since it was for when Cloudant had customers running a build local to them, we needed a tool to extract basic "wtf" info. and we only permitted installs on Linux.

It seems, the weatherreport needs some linux tools (ps) to work. These needs to be evaluated to find a equivalent for Windows with the same function/command output.

To get weatherreport running, there needs to be added the following files:

bin/weatherreport.cmd (Needs to be created, when CouchDB compiles):

@echo off
escript.exe "%~dpn0" %*

Makefile.win:

index a897554e7..55c4f3b33 100644
--- a/Makefile.win
+++ b/Makefile.win
@@ -97,7 +97,7 @@ TEST_OPTS=-c startup_jitter=0 -c default_security=admin_local

 .PHONY: all
 # target: all - Build everything
-all: couch fauxton docs
+all: couch fauxton docs escriptize

 ################################################################################
@@ -124,6 +124,11 @@ endif
 # target: fauxton - Build Fauxton web UI
 fauxton: share\www

+.PHONY: escriptize
+# target: escriptize - Build CLI tools
+escriptize: couch
+       @$(REBAR) -r escriptize apps=weatherreport
+       @cp src/weatherreport/weatherreport bin/weatherreport

 ################################################################################
 # Testing
@@ -264,6 +269,11 @@ mango-test: devclean all
                .venv\Scripts\pip.exe install -r requirements.txt
        @cd src\mango && .venv\Scripts\python.exe ..\..\dev\run -n 1 --admin=testuser:testpass .venv\Scripts\nose2

+.PHONY: weatherreport-test
+# target: weatherreport-test - Run weatherreport against dev cluster
+weatherreport-test: devclean escriptize
+       @dev\run -n 1 -a adm:pass --no-eval \
+               'bin\weatherreport --etc dev\lib\node1\etc --level error'

 ################################################################################
 # Developing