Lemur 3 Months Later

It have been almost 3 months since I received my new laptop from System76 and except for the keyboard and initial disappointment with the build quality, I have been very happy with my latest purchase.

Usage

I am using the Lemur are a personal and work laptop. Most evenings and weekends I am using it to browse the web and so some personal coding projects. During the working week the laptop accompanies me on the commute into London and when in the office I am doing a variety of things from development to email.

Portability

Carrying this laptop in a backpack for 1 hour, including several stops on the tube is fine. The Lemur is a very portable weight and carrying the laptop around the office is not a problem either.

Devices

I have not has any problems with connecting existing devices to the Lemur. Everything has just worked out of the box.

Ubuntu

Three weeks into my experience I did get a kernel panic and I had to reinstall Ubuntu and the System76 drivers. This was not a difficult task and I want to point out that this is more than likely to be an Ubuntu issues rather than a problem with System76 setup or the hardware.

I think the panic was caused by performing an update via Ubuntu’s software update package and this hung to some reason and I restarted the laptop. When the laptop was running through the boot process it hung and when I tried to boot in recovery mode I was shown a nice kernel panic error message.

Following the re-install I have had not issues, but I am staying clear of using Software Updater and sticking to good old apt-get update and apt-get upgrade commands.

Final Thoughts

I may revisit this post and add anything that I think might be useful, but for now I will leave my review of the Lemur7 with this view:

“A good, portable Linux laptop that comes with a configuration that should see me through the next three years of work and play.  I am sure I will be back on the System76 website when I consider my next upgrade!”

GCC and Code Coverage

My only experience with generating coverage results has been through Gcov and Lcov. This post shows a simple example of how to obtain the results and present them in HTML.

1 – Write a simple piece of code

#include 

void Example_function(int number);

int main(int argc, char* argv[]){
    Example_function(3);
    return 0;
}

void Example_function(int number)
{
  if ((number % 2) == 0){
      printf("even \n");
  }

  for (;number < 9; number++){
    printf("number is %d\n", number);
  }
}

2 – Compile with the flags required for code coverage.

gcc -fprofile-arcs -ftest-coverage -g sample.cpp -o sample

This should generate a .gcno file that is used to generate the code coverage date when the tests are executed.

3 – Run the tests

./sample

The tests will run (hopefully pass!) and then you will have a .gcda file that contains details of the coverage results.

4 – Run Gcov against the source file

gcov -b sample.cpp

The -b option will also give you branch coverage details, but you can just run this command without the options.

Once run, you will have a .cpp.gcov file that can be read to show all of the coverage details (although not in the most presentable way).

cat sample.cpp.gcov
-:    0:Source:sample.cpp
-:    0:Graph:sample.gcno
-:    0:Data:sample.gcda
-:    0:Runs:1
-:    0:Programs:1
-:    1:#include
-:    2:
-:    3:void Example_function(int number);
-:    4:
function main called 1 returned 100% blocks executed 100%
1:    5:int main(int argc, char* argv[])
-:    6:{
1:    7:    Example_function(3);
call    0 returned 100%
-:    8:
1:    9:    return 0;
-:   10:}
-:   11:
function _Z16Example_functioni called 1 returned 100% blocks executed 83%
1:   12:void Example_function(int number)
-:   13:{
-:   14:
1:   15:  if ((number % 2) == 0)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
-:   16:  {
#####:   17:      printf("even \n");
call    0 never executed
-:   18:  }
-:   19:
13:   20:  for (;number < 9; number++){
branch  0 taken 86% (fallthrough)
branch  1 taken 14%
-:   21:
6:   22:    printf("number is %d\n", number);
call    0 returned 100%
-:   23:
-:   24:  }
-:   25:
1:   26:}
-:   27:
-:   28:

5. Install lcov (Ubuntu)

sudo apt install lcov

6. Run lcov

lcov --capture --directory [Location of gcda files] --output-file [Location to send lcov results]

7. Open index.html in your favorite browser

firefox index.html

Selection_002

8. External links

https://gcc.gnu.org/onlinedocs/gcc/Invoking-Gcov.html#Invoking-Gcov

http://www.linux-mag.com/id/1409/

https://qiaomuf.wordpress.com/2011/05/26/use-gcov-and-lcov-to-know-your-test-coverage/

 

Linux

I have been using Linux at home and in the work place for sometime now and my intention for these blog posts are a place where I can save all of the details of how to set-up various things (mostly focusing on Ubuntu).

I hope that it will at least help me to remember various things I have tinkered with over the months and years.

Blog at WordPress.com.

Up ↑