Why the tests are not running ? ( Golang ) - goapp test - bug? - google-app-engine

I'm trying to run GAE tests on multiple packages. My app (testapp ) looks as below:
testapp>
README.md package1 package2
each package has two go files. One is the package itself the other is the 'test' package.
package1
$ls package1
package1.go package1_test.go
package2
$ls package2
package2.go package2_test.go
To run the tests I use
goapp test -v ./...
Output:
warning: building out-of-date packages:
github.com/mihai/API
installing these packages with 'go test -i ./...' will speed future tests.
=== RUN TestGetDiskFile
codelistgobfile.gob
codelist.gob written successfully
--- PASS: TestGetDiskFile (0.00 seconds)
PASS
ok testapp/package1 0.010s
However as you can see above it seems to run only the first test ( TestGetDiskFile ) from package1. After that it gets stuck. I get no kind of output. If I go in each package ( cd package 1 ) and run goapp test all the tests (about 20 tests) run successfully
Any idea how I can fix / run all the tests without getting stuck or at least how I can debug it further? is this a goapp bug?
I've tried on two different machines ( Mac osx , and ubuntu ), the result is same.

To debug, strip things down to a minimal test case. For example, the following is a minimal test case for go test -v ./.... Try something similar for goapp test -v ./....
$ dir
package1 package2
$ tree ../packages
../packages
├── package1
│   └── package1_test.go
└── package2
└── package2_test.go
2 directories, 2 files
$ go test -v ./...
=== RUN TestPackage1
--- PASS: TestPackage1 (0.00 seconds)
PASS
ok packages/package1 0.004s
=== RUN TestPackage2
--- PASS: TestPackage2 (0.00 seconds)
PASS
ok packages/package2 0.004s
$
File: package1_test.go:
package package1
import "testing"
func TestPackage1(t *testing.T) {}
File: package2_test.go:
package package2
import "testing"
func TestPackage2(t *testing.T) {}

Related

Unable to compile PnetCDF: 'tst_rec_vars' test fails

I am trying to install PnetCDF from source. I used the 1.12.2 version for installation. MPICH, Zlib, Szip, HDF5 and NetCDF-4 have been installed from source successfully (HDF5 and NetCDF-4 have been built with parallel I/O support).
MPICH is installed as follows (v3.4.2):
./configure --prefix=${DIR}/mpich --with-device=ch4:ofi CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" --enable-fortran
make
make check
make install
export PATH=${DIR}/mpich/bin:${PATH}
Where DIR is the root directory all the libraries are installed to (with their own directory).
Zlib (v1.2.11):
./configure --prefix=${DIR}/grib2
make
make check
make install
export CPPFLAGS="-I${DIR}/grib2/include"
export LDFLAGS="-L${DIR}/grib2/lib"
export LD_LIBRARY_PATH="${DIR}/grib2/lib:$LD_LIBRARY_PATH"
Szip (v2.1.1):
./configure --prefix=${DIR}/szip
CC=mpicc
make
make check
make install
export LD_LIBRARY_PATH="${DIR}/szip/lib:$LD_LIBRARY_PATH"
export CPPFLAGS="-I${DIR}/szip/include ${CPPFLAGS}"
export LDFLAGS="-L${DIR}/szip/lib ${LDFLAGS}"
HDF5 (v1.8.22):
export HDF5=${DIR}/hdf5
./configure --prefix=${HDF5} --with-szlib=${DIR}/szip --with-zlib=${DIR}/grib2 --enable-parallel CC=mpicc --enable-fortran FC=mpifort
make
make check
make install
export LD_LIBRARY_PATH="${HDF5}/lib:$LD_LIBRARY_PATH"
export CPPFLAGS="-I${HDF5}/include ${CPPFLAGS}"
export LDFLAGS="-L${HDF5}/lib ${LDFLAGS}"
export PATH="${HDF5}/bin:${PATH}"
NetCDF4-C (v4.8.0):
./configure --prefix=${DIR}/netcdf --disable-dap --enable-parallel-tests --enable-large-file-tests --disable-extreme-numbers CC=mpicc
make
make check
make install
export PATH="${NETCDF}/bin:${PATH}"
export LD_LIBRARY_PATH="${NETCDF}/lib:${LD_LIBRARY_PATH}"
export CPPFLAGS="-I${NETCDF}/include ${CPPFLAGS}"
export LDFLAGS="-L${NETCDF}/lib ${LDFLAGS}"
export LIBS="$(nc-config --libs) ${LIBS}"
NetCDF4-Fortran (v4.5.3):
./configure --prefix=${NETCDF} --enable-large-file-tests --enable-parallel-tests CC=${DIR}/mpich/bin/mpicc FC=mpifort F77=mpif77
make
make check
make install
The HDF5 configuration shown by h5pcc -showconfig is given below (only the part I think relevant is included):
Features:
---------
Parallel HDF5: yes
High-level library: yes
Build HDF5 Tests: yes
Build HDF5 Tools: yes
Threadsafety: no
Default API mapping: v18
With deprecated public symbols: yes
I/O filters (external): deflate(zlib),szip(encoder)
MPE:
Direct VFD: no
(Read-Only) S3 VFD: no
(Read-Only) HDFS VFD: no
dmalloc: no
Clear file buffers before write: yes
Using memory checker: no
Function stack tracing: no
Strict file format checks: no
Optimization instrumentation: no
And the output of nc-config --all:
--cc -> /media/case/work/hwrf/libraries/mpich/bin/mpicc
--cflags -> -I/media/case/work/hwrf/libraries/netcdf/include -I/media/case/work/hwrf/libraries/hdf5/include -I/media/case/work/hwrf/libraries/szip/include -I/media/case/work/hwrf/libraries/grib2/include
--libs -> -L/media/case/work/hwrf/libraries/netcdf/lib -lnetcdf
--static -> -lhdf5_hl -lhdf5 -lm -ldl -lz -lcurl
--has-c++ -> no
--cxx ->
--has-c++4 -> no
--cxx4 ->
--has-fortran -> yes
--fc -> mpifort
--fflags -> -I/media/case/work/hwrf/libraries/netcdf/include -I/media/case/work/hwrf/libraries/netcdf/include
--flibs -> -L/media/case/work/hwrf/libraries/netcdf/lib -lnetcdff
--has-f90 ->
--has-f03 -> yes
--has-dap -> no
--has-dap2 -> no
--has-dap4 -> no
--has-nc2 -> yes
--has-nc4 -> yes
--has-hdf5 -> yes
--has-hdf4 -> no
--has-logging -> no
--has-pnetcdf -> no
--has-szlib -> yes
--has-cdf5 -> yes
--has-parallel4 -> yes
--has-parallel -> yes
--has-nczarr -> no
--prefix -> /media/case/work/hwrf/libraries/netcdf
--includedir -> /media/case/work/hwrf/libraries/netcdf/include
--libdir -> /media/case/work/hwrf/libraries/netcdf/lib
--version -> netCDF 4.8.0
So far, so good. Everything was installed without any failure. All make checks have been passed.
The trouble arises when I try to compile PnetCDF from source. I tried PnetCDF version 1.11.2 for installation (in fact, I triedd several older versions as well, more on that later). The installation is attempted as following:
./configure --prefix=${DIR}/pnetcdf --enable-large-single-req --enable-netcdf4 --enable-shared=yes --with-netcdf4="${DIR}/netcdf" MPICC=mpicc MPIF77=mpif77 MPIF90=mpif90 MPICC=mpicc MPIF77=mpif77 MPIF90=mpif90
make
make tests
make check
make ptest
make ptests
But, it fails at make ptest. The failed test is tst_rec_vars.c and the error message is:
Error at line 78 of tst_rec_vars.c: expect dim X len 4 but got 3
Error at line 78 of tst_rec_vars.c: expect dim X len 4 but got 3 fail with 2 mismatches
make[2]: *** [Makefile:1354: ptest4] Error 1
make[2]: Leaving directory '/media/case/work/hwrf/libraries/source/pnetcdf-1.12.2/test/nc4'
make[1]: *** [Makefile:780: ptests] Error 1
make[1]: Leaving directory '/media/case/work/hwrf/libraries/source/pnetcdf-1.12.2/test'
make: *** [Makefile:965: ptests] Error 1
Heres the test that is failing (GitHub link): tst_rec_vars.c
It seems that the test is checking a NetCDF file for the lenth of dimension in it. I assume the NetCDF file it is checking is tst_rec_vars.nc. The output of ncdump -h on this file is given below:
netcdf tst_rec_vars {
dimensions:
X = UNLIMITED ; // (4 currently)
variables:
int U(X) ;
int V(X) ;
}
That is, the NetCDF file's X dimension indeed has a length 4, although the test program beleives it is only 3. But, if I were to run the test manually as ./tst_rec_vars, it runs correctly.
*** TESTING C tst_rec_vars for record variables to NetCDF4 file ------ pass
Could it be due to parallel processing/threading? The test in question is run under a section titled test/nc4: Parallel testing on 4 MPI processes. I assume the NetCDF file was tested before it was formed completely, which could explain why I got a length 1 X dimension in the NetCDF file from ncdump at one point.
>>>ncdump -h tst_rec_vars.nc
netcdf tst_rec_vars {
dimensions:
X = UNLIMITED ; // (1 currently)
variables:
int U(X) ;
int V(X) ;
}
What exactly is going on here? How do I fix it?
Edit:
I'm trying to install it on CentOS 7, since I was encountering the above mentioned issue, I tried to install it on a Debian 11 system. But I am getting the very exact error in both systems.

Jest running all files in import Tree

I've recently come across an interesting/peculiar side effect, wanted to know opinion of the experienced members out here.
When i run the command npm run test -- --testPathPattern="filePath" --coverage, I get the coverage info as follows -
Statements : 37.85% ( 5810/15350 )
Branches : 7.2% ( 547/7596 )
Functions : 10.66% ( 309/2898 )
Lines : 42.1% ( 5751/13660 )
================================================================================
5810 lines being run, 547 branches being tested is huge. I went debugging into this, and realized to an extent why this is happening.
All files in the import tree are are being run !!!
This could potentially why CI takes time, and testing gets heavy.
Can i get any pointers on fixing this please
It's not "all files in the import tree", it's all files period. The --coverage options collects the coverage stats of your codebase with tests, also generates a coverage report, that you probably don't need.
If this is a concern in the CI pipeline don't use the coverage option, just run the tests.

AOSP Build TARGET_PRODUCT fails

I'm trying to build an external tool with AOSP. My OS is Linux, Distribution ArchLinux (i3wm), but to compile AOSP I use Ubuntu in Docker (https://android.googlesource.com/platform/build/+/master/tools/docker)
First step:
# init repo
repo init -u https://android.googlesource.com/platform/manifest -b android-8.0.0_r36 --depth=1
repo sync
. build/envsetup.sh # set up environment
lunch aosp_arm-eng # select target to build
Second step: select tool and build
cd external/selinux
mma -j48
Output:
ninja: error: unknown target 'MODULES-IN-'
15:41:55 ninja failed with: exit status 1
make: *** [run_soong_ui] Error 1
make: Leaving directory `/home/user/aosp'
#### make failed to build some targets (6 seconds) ###
Another tool
cd external/wpa_supplicant_8
mma -j48
Output:
ninja: error: unknown target 'MODULES-IN-external-wpa_supplicant_8'
15:41:55 ninja failed with: exit status 1
make: *** [run_soong_ui] Error 1
make: Leaving directory `/home/user/aosp'
#### make failed to build some targets (2 seconds) ###
This happens with any aosp generic target:
Lunch menu... pick a combo:
1. aosp_arm-eng # fails
2. aosp_arm64-eng # fails
3. aosp_mips-eng # fails
4. aosp_mips64-eng # fails
5. aosp_x86-eng # fails
6. aosp_x86_64-eng # fails
7. full_fugu-userdebug # works
8. aosp_fugu-userdebug # works
9. car_emu_arm64-userdebug # fails
10. car_emu_arm-userdebug # fails
11. car_emu_x86_64-userdebug # fails
12. car_emu_x86-userdebug # fails
13. mini_emulator_arm64-userdebug # fails
14. m_e_arm-userdebug # fails
15. m_e_mips64-eng # fails
16. m_e_mips-userdebug # fails
17. mini_emulator_x86_64-userdebug # fails
18. mini_emulator_x86-userdebug # fails
19. aosp_dragon-userdebug # works
20. aosp_dragon-eng # works
21. aosp_marlin-userdebug # works
22. aosp_marlin_svelte-userdebug # works
23. aosp_sailfish-userdebug # works
24. aosp_angler-userdebug # works
25. aosp_bullhead-userdebug # works
26. aosp_bullhead_svelte-userdebug # works
27. hikey-userdebug # works
I want to compile some binary tools in all arch: arm, arm64, x86 and x86_64.
Why aosp_arm-eng does not work? Or how can I change the CPU architecture from non generic aosp target?
Using tapas does not work.
You probably need to make a full AOSP build before trying to use mm... shortcuts - looks like some build script files were not generated yet.
clear all the binaries from /out dir with make clean command & then try to make a full build
Actually there is no need to do a full build. Just open your Android.mk or Android.bp of the module you want to build, and look for variable MODULE_NAME.
Then from the root of the project make
mm $MODULE_NAME
It should build all the dependencies you need first.
I suggest that use the mmm command for building. Also make sure that the directory you are pointing to contains a Android.bp or Android.mk
mmm /external/selinux
Also I suggest to clean the outputs by remove the out directory or simply run:
make clean
If still you have that problem, remove the --depth=1 argument on repo init and sync it again. that argument limits the commit fetching from remote branch.
Use below commands to compile module from root dir
Goto root dir
make clean
source build/envsetup.sh
lunch "select option"
make "module name" -j8

yeoman angular generator finishes but empty directory

So I installed all deps and and have been trying to use yo angular, and everything seems to complete alright, except that the resulting directory is empty after everything finishes.
Thoughts as to why?
leonsas at leonsas in ~/testdataops> yo angular dataops
_-----_
| | .--------------------------.
|--(o)--| | Welcome to Yeoman, |
`---------´ | ladies and gentlemen! |
( _´U`_ ) '--------------------------'
/___A___\
| ~ |
__'.___.'__
´ ` |° ´ Y `
Out of the box I include Bootstrap and some AngularJS recommended modules.
? Would you like to use Gulp (experimental) instead of Grunt? No
? Would you like to use Sass (with Compass)? Yes
? Would you like to include Bootstrap? Yes
? Would you like to use the Sass version of Bootstrap? Yes
? Which modules would you like to include? angular-animate.js, angular-cookies.js, angular-resource.js, angular-route.js, angular-sanitize.js, angular-touch.js
conflict app/styles/main.scss
? Overwrite app/styles/main.scss? overwrite
force app/styles/main.scss
conflict app/index.html
? Overwrite app/index.html? overwrite
force app/index.html
identical bower.json
identical .bowerrc
conflict package.json
? Overwrite package.json? overwrite
force package.json
identical Gruntfile.js
identical README.md
invoke angular:common:/Users/leonsas/.npm-packages/lib/node_modules/generator-angular/app/index.js
identical .editorconfig
identical .gitattributes
identical .jscsrc
identical .jshintrc
conflict .yo-rc.json
? Overwrite .yo-rc.json? overwrite
force .yo-rc.json
identical .gitignore
identical test/.jshintrc
identical app/404.html
identical app/favicon.ico
identical app/robots.txt
identical app/views/main.html
identical app/images/yeoman.png
invoke angular:main:/Users/leonsas/.npm-packages/lib/node_modules/generator-angular/app/index.js
conflict app/scripts/app.js
? Overwrite app/scripts/app.js? overwrite
force app/scripts/app.js
invoke angular:controller:/Users/leonsas/.npm-packages/lib/node_modules/generator-angular/app/index.js
conflict app/scripts/controllers/main.js
? Overwrite app/scripts/controllers/main.js? overwrite
force app/scripts/controllers/main.js
conflict test/spec/controllers/main.js
? Overwrite test/spec/controllers/main.js? overwrite
force test/spec/controllers/main.js
Just found a `.yo-rc.json` in a parent directory.
Setting the project root at: /Users/leonsas
invoke karma:app
I'm all done. Running bower install & npm install for you to install the required dependencies. If this fails, try running the command yourself.
invoke angular:route
invoke angular:controller:/Users/leonsas/.npm-packages/lib/node_modules/generator-angular/route/index.js
conflict app/scripts/controllers/about.js
? Overwrite app/scripts/controllers/about.js? overwrite
force app/scripts/controllers/about.js
conflict test/spec/controllers/about.js
? Overwrite test/spec/controllers/about.js? (Ynaxdh) conflict test/karma.conf.js
▌ ╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
? Overwrite test/spec/controllers/about.js? overwrite
force test/spec/controllers/about.js
? Overwrite test/karma.conf.js? overwrite
force test/karma.conf.js
conflict package.json
? Overwrite package.json? (Ynaxdh) invoke angular:view:/Users/leonsas/.npm-packages/lib/node_modules/generator-angular/route/index.js
? Overwrite package.json? overwrite
force package.json(Ynaxdh)
▌ ╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
dataops# /Users/leonsas
└── angular-bootstrap-starter#1.0.1 extraneous
Running "wiredep:app" (wiredep) task
Running "wiredep:test" (wiredep) task
Running "wiredep:sass" (wiredep) task
Done, without errors.
Execution Time (2016-02-24 02:18:38 UTC)
loading tasks 168ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 48%
loading grunt-wiredep 8ms ▇▇▇▇ 2%
wiredep:app 143ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 41%
wiredep:test 11ms ▇▇▇▇▇ 3%
wiredep:sass 20ms ▇▇▇▇▇▇▇▇ 6%
Total 351ms
dataops# /Users/leonsas
└── angular-bootstrap-starter#1.0.1 extraneous
leonsas at leonsas in ~/testdataops> ls
leonsas at leonsas in ~/testdataops> node -v
v5.6.0
leonsas at leonsas in ~/testdataops> npm -v
3.7.3

CPAN installs module and doesn't see it after...cpan database issue?

I have this issue with some Perl modules on Fedora Linux. They are installed correctly and not show up in the list after.
For example I run:
cpan XML::SAX::Base
it produced lengthy output like:
-------------------------------------------------
Reading '/root/.cpan/Metadata'
Database was generated on Tue, 12 Aug 2014 23:41:02 GMT
Running install for module 'XML::SAX::Base'
Running make for G/GR/GRANTM/XML-SAX-Base-1.08.tar.gz
Checksum for /root/.cpan/sources/authors/id/G/GR/GRANTM/XML-SAX-Base-1.08.tar.gz ok
CPAN.pm: Building G/GR/GRANTM/XML-SAX-Base-1.08.tar.gz
Checking if your kit is complete...
Looks good
Writing Makefile for XML::SAX::Base
Writing MYMETA.yml and MYMETA.json
cp lib/XML/SAX/Base.pm blib/lib/XML/SAX/Base.pm
cp lib/XML/SAX/Exception.pm blib/lib/XML/SAX/Exception.pm
cp BuildSAXBase.pl blib/lib/XML/SAX/BuildSAXBase.pl
Manifying blib/man3/XML::SAX::Exception.3pm
Manifying blib/man3/XML::SAX::BuildSAXBase.3pm
Manifying blib/man3/XML::SAX::Base.3pm
GRANTM/XML-SAX-Base-1.08.tar.gz
/usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00basic.t ............. ok
t/01exception.t ......... ok
t/01simpledriver.t ...... ok
t/02simplefilter.t ...... ok
t/03chdriver.t .......... ok
t/04chfilter.t .......... ok
t/05dtdhdriver.t ........ ok
t/06lexhdriver.t ........ ok
t/07declhdriver.t ....... ok
t/08errorhdriver.t ...... ok
t/09resoldriver.t ....... ok
t/10dochdriver.t ........ ok
t/11sax1multiclass.t .... ok
t/12sax2multiclass.t .... ok
t/13handlerswitch.t ..... ok
t/14downstreamswitch.t .. ok
t/15parentswitch.t ...... ok
t/16gethandlers.t ....... ok
t/release-pod-syntax.t .. skipped: these tests are for release candidate testing
All tests successful.
Files=19, Tests=137, 1 wallclock secs ( 0.09 usr 0.03 sys + 0.61 cusr 0.11 csys = 0.84 CPU)
Result: PASS
GRANTM/XML-SAX-Base-1.08.tar.gz
/usr/bin/make test -- OK
Running make install
Manifying blib/man3/XML::SAX::Exception.3pm
Manifying blib/man3/XML::SAX::BuildSAXBase.3pm
Manifying blib/man3/XML::SAX::Base.3pm
Appending installation info to /root/perl5/lib/perl5/x86_64-linux-thread-multi/perllocal.pod
GRANTM/XML-SAX-Base-1.08.tar.gz
/usr/bin/make install -- OK
--------------------------------------------
Looks like the module installed. When I run:
cpan -l | grep SAX
it gives nothing.
If I run installation again:
cpan XML::SAX::Base
it will install it again.
I guess something wrong with the database, is there any way to fix it?
Finally, I was able to fix this problem. As I understand, the whole problem was in installation of different parts of Perl in different folders. For example, I had /root/perl5 folder and /home/user1/perl5 folder.I was not able to install modules as a non-root user. I had to switch to root any time, I was installing any module. Then I had to switch back to user when I was creating perl script. Now I moved everything to normal user and it's finally working.
That is how I did it:
First under root:
su - ;
rm -fr /home/user/perl5/ ;
mv -f perl5 /home/user/ ;
chown -fR user /home/user/perl5 ;
chgrp -fR user /home/user/perl5 ;
exit `
Second under user:
PATH=$PATH:/home/user/perl5/bin;
export PERL5LIB=/home/user/perl5/lib/perl5/;
Those two commands you need to enter every time after reboot or use ~/.bashrc
Now I can do either cpan XML::SAX::Base or cpanm XML::SAX::Base and it is all good and I don't need to switch to root any more every time I install modules!!!

Resources