support/testing: allow run-tests to be called from anywhere

Currently run-tests must be called from the Buildroot top directory.

Derive the top directory from the script path, so run-tests can be called from
any path.
As a consequence the test infra will always test the repo it belongs to.

Suggested-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Yann E. MORIN <yann.morin.1998@free.fr>
---
The suggestion happened one year ago, but I just remembered it now that
I need the base dir to be used by a test case.
Search for "derive the top" in
http://patchwork.ozlabs.org/patch/814544/
72 jobs for check-package-path-v1-2-runtime-tests in 181 minutes and 29 seconds (queued for 2 seconds)
latest
Status Name Job ID Coverage
  Test
passed check-DEVELOPERS #116014469

00:01:08

passed check-flake8 #116014470

00:01:40

passed check-gitlab-ci.yml #116014468

00:01:07

passed check-package #116014471

00:01:08

passed tests.boot.test_atf.TestATFAllwinner #116014472

00:12:17

passed tests.boot.test_atf.TestATFMarvell #116014473

00:14:27

passed tests.boot.test_atf.TestATFVexpress #116014474

00:13:53

failed tests.core.test_file_capabilities.TestFileCapabilities #116014475

00:23:45

passed tests.core.test_hardening.TestFortifyConserv #116014476

00:04:21

passed tests.core.test_hardening.TestFortifyNone #116014477

00:03:54

passed tests.core.test_hardening.TestRelro #116014478

00:03:56

passed tests.core.test_hardening.TestRelroPartial #116014479

00:04:11

passed tests.core.test_hardening.TestSspNone #116014480

00:04:05

passed tests.core.test_hardening.TestSspStrong #116014481

00:03:52

passed tests.core.test_post_scripts.TestPostScripts #116014482

00:02:13

passed tests.core.test_rootfs_overlay.TestRootfsOverlay #116014483

00:01:45

passed tests.core.test_timezone.TestGlibcAllTimezone #116014484

00:04:03

passed tests.core.test_timezone.TestGlibcNonDefaultLimitedTimezone #116014485

00:04:07

passed tests.core.test_timezone.TestNoTimezone #116014486

00:04:00

passed tests.fs.test_ext.TestExt2 #116014487

00:06:45

passed tests.fs.test_ext.TestExt2r1 #116014488

00:06:52

passed tests.fs.test_ext.TestExt3 #116014489

00:07:10

passed tests.fs.test_ext.TestExt4 #116014490

00:06:36

passed tests.fs.test_iso9660.TestIso9660Grub2External #116014491

00:26:48

passed tests.fs.test_iso9660.TestIso9660Grub2ExternalCompress #116014492

00:26:12

passed tests.fs.test_iso9660.TestIso9660Grub2Internal #116014493

00:26:05

passed tests.fs.test_iso9660.TestIso9660SyslinuxExternal #116014494

00:27:39

passed tests.fs.test_iso9660.TestIso9660SyslinuxExternalCompress #116014495

00:27:11

passed tests.fs.test_iso9660.TestIso9660SyslinuxInternal #116014496

00:27:26

passed tests.fs.test_jffs2.TestJffs2 #116014497

00:05:54

passed tests.fs.test_squashfs.TestSquashfs #116014498

00:06:21

passed tests.fs.test_ubi.TestUbi #116014499

00:05:46

passed tests.fs.test_yaffs2.TestYaffs2 #116014500

00:02:17

passed tests.init.test_busybox.TestInitSystemBusyboxRo #116014501

00:06:10

passed tests.init.test_busybox.TestInitSystemBusyboxRoNet #116014502

00:06:13

passed tests.init.test_busybox.TestInitSystemBusyboxRw #116014503

00:06:48

passed tests.init.test_busybox.TestInitSystemBusyboxRwNet #116014504

00:06:44

passed tests.init.test_none.TestInitSystemNone #116014505

00:06:09

passed tests.init.test_systemd.TestInitSystemSystemdRoFull #116014506

00:47:57

passed tests.init.test_systemd.TestInitSystemSystemdRoIfupdown #116014507

00:34:34

passed tests.init.test_systemd.TestInitSystemSystemdRoNetworkd #116014508

00:35:43

passed tests.init.test_systemd.TestInitSystemSystemdRwFull #116014509

00:45:40

passed tests.init.test_systemd.TestInitSystemSystemdRwIfupdown #116014510

00:37:52

passed tests.init.test_systemd.TestInitSystemSystemdRwNetworkd #116014511

00:38:24

passed tests.package.test_dropbear.TestDropbear #116014512

00:05:21

passed tests.package.test_ipython.TestIPythonPy2 #116014513

00:11:44

passed tests.package.test_ipython.TestIPythonPy3 #116014514

00:12:13

passed tests.package.test_python.TestPython2 #116014515

00:10:10

passed tests.package.test_python.TestPython3 #116014516

00:11:39

passed tests.package.test_python_autobahn.TestPythonPy2Autobahn #116014517

00:10:17

passed tests.package.test_python_autobahn.TestPythonPy3Autobahn #116014518

00:10:42

passed tests.package.test_python_cryptography.TestPythonPy2Cryptography #116014519

00:12:54

passed tests.package.test_python_cryptography.TestPythonPy3Cryptography #116014521

00:14:22

passed tests.package.test_python_incremental.TestPythonPy2Incremental #116014522

00:10:33

passed tests.package.test_python_incremental.TestPythonPy3Incremental #116014523

00:11:47

passed tests.package.test_python_twisted.TestPythonPy2Twisted #116014524

00:11:48

passed tests.package.test_python_twisted.TestPythonPy3Twisted #116014525

00:12:59

passed tests.package.test_python_txaio.TestPythonPy2Txaio #116014526

00:10:38

passed tests.package.test_python_txaio.TestPythonPy3Txaio #116014527

00:11:37

passed tests.package.test_python_txtorcon.TestPythonPy2Txtorcon #116014528

00:13:23

passed tests.package.test_python_txtorcon.TestPythonPy3Txtorcon #116014529

00:15:27

failed tests.package.test_rust.TestRust #116014530

03:00:00

passed tests.package.test_rust.TestRustBin #116014531

00:37:30

passed tests.package.test_syslog_ng.TestSyslogNg #116014532

00:23:59

passed tests.toolchain.test_external.TestExternalToolchainBuildrootMusl #116014533

00:04:11

passed tests.toolchain.test_external.TestExternalToolchainBuildrootuClibc #116014534

00:04:29

passed tests.toolchain.test_external.TestExternalToolchainCCache #116014535

00:04:57

passed tests.toolchain.test_external.TestExternalToolchainCtngMusl #116014536

00:04:12

passed tests.toolchain.test_external.TestExternalToolchainLinaroArm #116014537

00:04:19

passed tests.toolchain.test_external.TestExternalToolchainSourceryArmv4 #116014538

00:03:51

passed tests.toolchain.test_external.TestExternalToolchainSourceryArmv5 #116014539

00:03:39

passed tests.toolchain.test_external.TestExternalToolchainSourceryArmv7 #116014540

00:03:51

 
Name Stage Failure
failed
tests.core.test_file_capabilities.TestFileCapabilities Test
Ran 1 test in 1359.125s

FAILED (failures=1)
Uploading artifacts...
test-output/*.log: found 2 matching files
test-output/*/.config: found 1 matching files

test-output/*/images/*: found 3 matching files

Uploading artifacts to coordinator... ok
id=116014475 responseStatus=201 Created token=-p_f98n-
ERROR: Job failed: exit code 1
failed
tests.package.test_rust.TestRust Test
Using docker image sha256:aa26f7fda9336fa4ef8266f22f78f3df483ac0edf3a14a09665615c95fd26972 for buildroot/base:20180318.1724 ...
Running on runner-fa6cab46-project-3755559-concurrent-0 via runner-fa6cab46-srm-1541217195-ceef12e3...
Cloning repository...
Cloning into '/builds/RicardoMartincoski/buildroot'...
Checking out bf600c58 as check-package-path-v1-2-runtime-tests...
Skipping Git submodules setup
$ ./support/testing/run-tests -o test-output/ -d test-dl/ -k --timeout-multiplier 10 ${CI_JOB_NAME}
Pulling docker image gitlab/gitlab-runner-helper:x86_64-cf91d5e1 ...
ERROR: Job failed: execution took longer than 3h0m0s seconds