[riot-notifications] [RIOT-OS/RIOT] unexport TERM* variables (#11064)

Gaëtan Harter notifications at github.com
Mon Feb 25 17:42:40 CET 2019


### Contribution description

TERMPROG and TERMFLAGS variables do not need to be exported as they are
used directly by a make receipe.

Exporting them prevents overwriting 'RIOT_TERMINAL' in the test.


#### Other uses to unexport:

There is one remaining usage of `export TERMFLAGS` but it should be handled alone as it does not make sense as it does not handle `RIOT_TERMINAL`. I will add it to the tracking issue.

```
git grep -e 'export TERM'
boards/nz32-sc151/Makefile.include:export TERMFLAGS = -p $(PORT)
```

### Testing procedure

#### Review
We can see that there are not usages in other places than recipes that are declared in `Makefile.include`:


```
git grep -e '$(TERMPROG)' -e '$(TERMFLAGS)' -e '${TERMPROG}' -e '${TERMFLAGS}'
Makefile.include:       $(call check_cmd,$(TERMPROG),Terminal program)
Makefile.include:       $(TERMPROG) $(TERMFLAGS)
boards/native/Makefile.include:TERMFLAGS := $(PORT) $(TERMFLAGS)
boards/native/Makefile.include:  export DEBUGGER_FLAGS = -- $(ELFFILE) $(TERMFLAGS)
boards/native/Makefile.include:  export DEBUGGER_FLAGS = -q --args $(ELFFILE) $(TERMFLAGS)
makefiles/info.inc.mk:  @echo 'TERMPROG:  $(TERMPROG)'
makefiles/info.inc.mk:  @echo 'TERMFLAGS: $(TERMFLAGS)'
```


There are no more exports of `TERMFLAGS` or `TERMPROG` except the one already mentioned earlier:

```
git grep -e 'export TERM'
boards/nz32-sc151/Makefile.include:export TERMFLAGS = -p $(PORT)
```

### Testing `make term`

It is still working for both native and boards. You can try

```
make -C examples/hello-world/ all term
BOARD=samr21-xpro make -C examples/default all term
```

The `term-gprof` for native is not working both in master and with this PR.

### Overwriting `RIOT_TERMINAL` in testrunner:

The usage within `make test` can be checked with this diff.
With it, running a test on a board should use `socat`

``` diff
diff --git a/dist/pythonlibs/testrunner/__init__.py b/dist/pythonlibs/testrunner/__init__.py
index 67489f00c..06f086a02 100755
--- a/dist/pythonlibs/testrunner/__init__.py
+++ b/dist/pythonlibs/testrunner/__init__.py
@@ -38,6 +38,7 @@ def find_exc_origin(exc_info):
 
 def run(testfunc, timeout=10, echo=True, traceback=False):
     env = os.environ.copy()
+    env['RIOT_TERMINAL'] = 'socat'
     child = pexpect.spawnu("make term", env=env, timeout=timeout, codec_errors='replace')
```

```
BOARD=samr21-xpro  make -C tests/bloom_bytes/ flash test
make: Entering directory '/home/harter/work/git/RIOT/tests/bloom_bytes'
...
Programming..................................................... done.
Verification..................................................... done.
socat - open:/dev/ttyACM0,b115200,echo=0,raw
adding 512 elements took 262ms
checking 10000 elements took 2468ms

267 elements probably in the filter.
9733 elements not in the filter.
 false positive rate.

All done!
main(): Tmain(): This is RIOT! (Version: 2019.04-devel-269-g3b11-pr/bug/export/term_variables)
Testing Bloom filter.

m: 4096 k: 8

adding 512 elements took 262ms
checking 10000 elements took 2468ms

267 elements probably in the filter.
9733 elements not in the filter.
 false positive rate.

All done!

make: Leaving directory '/home/harter/work/git/RIOT/tests/bloom_bytes'
```


### Issues/PRs references

Tracking issue https://github.com/RIOT-OS/RIOT/issues/10850
Was an effective issue while working on https://github.com/RIOT-OS/RIOT/pull/10952

You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/11064

-- Commit Summary --

  * makefiles/vars.inc.mk: unexport TERM* variables
  * makefiles/tools/serial.inc.mk: unexport TERM* variables
  * boards/native: unexport TERM* variables

-- File Changes --

    M boards/native/Makefile.include (6)
    M makefiles/tools/serial.inc.mk (12)
    M makefiles/vars.inc.mk (4)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/11064.patch
https://github.com/RIOT-OS/RIOT/pull/11064.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11064
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190225/9876c3eb/attachment.html>


More information about the notifications mailing list