In this lab you will get organized for doing development on the Thumper project. There are no artifacts of this lab to turn in; instead the lab is about getting repositories cloned, software installed (if appropriate), and walking through the build/test process of the existing system.
If you already cloned Thumper directly from my GitHub account (pchapin/thumper), you should remove your clone before proceeding. Instead, you will want to make a personal fork of the repository before you clone it. In GitHub desktop do a right click on any existing Thumper clone and select "Remove". Be sure to check the box that says, "also move this repository to the recycle bin." If you don't do that, the repository will be removed from GitHub Desktop, but remain on your system (which you don't want)
Go to the Thumper page on GitHub and click on the "Fork" button in the upper right corner of the page. This will create a fork of the repository in your own space. You can do whatever you like with your fork (within the allowances of the Thumper's license). Clone your fork of Thumper to your system.
Inside your fork you can change what you like and push your changes back to GitHub. You can create branches that are local to your system, or you can publish branches to your GitHub account. You can also pull changes from the Thumper "upstream" repository (i.e., my version) into your fork. Mostly importantly, you can create "pull requests" against the upstream repository if you want to submit contributions. This is the normal way in which open source projects receive contributions from others.
In order to build and test Thumper you will need to install some additional software. The discussion below assumes you are using a Windows system. I have also included some notes for macOS users.
Download and install GtkAda from AdaCore. Be sure you select your host operating system (Windows, 64 bit) from the dropdown first. GtkAda is a graphical user interface library used by the Thumper client. Note for macOS users: GtkAda is not available for macOS.
Download and install the PostgreSQL database server. PostgreSQL is used by the Thumper server. It also provides the OpenSSL cryptographic library that is used by both the client and the server. Be sure you install the 64 bit version of PostgreSQL. Note that Thumper currently assumes you will be using PostgreSQL version 14.x. If you use a different version, you will need to make some changes to the project file (described later).
Ultimately, the Thumper server will also require AWS (Ada Web Server), but you do not need to install that now. Instructions for doing so will be provided later.
Set up PostgreSQL by first adding C:\Program Files\PostgreSQL\14\bin to your PATH environment variable (note for macOS users: the PostgreSQL tools might already be in your path; use 'which createdb' to find out). Then create a database user named 'thumper' with password 'rabbitsfoot' and then creating a database named "ThumperServer" as follows: Open a console window and enter the following commands:
$ psql -U postgres postgres=> CREATE ROLE thumper WITH LOGIN CREATEDB PASSWORD 'rabbitsfoot'; postgres=> \q $ createdb -U thumper ThumperServer
To check if the above worked, log into the database server as the thumper user, attaching to the ThumperServer database, and get a list of tables in that database. You should see an empty list.
$ psql -U thumper -d ThumperServer ThumperServer=> \dt Did not find any relations. ThumperServer=> \q
Now you should verify that you can build the existing system and run the tests. Proceed as follows:
Load thumper.gpr into GNATstudio. Build the test programs (hermes_test and thumper_test and run them. The tests should build fine (perhaps with some warnings). Some tests in hermes_test are failing. That is a known issue. Note to macOS users: You must comment out the "with" of gtkada.gpr in the Thumper project file. You must also change the path to the PostgreSQL library folder to whatever is appropriate on your system.
Build the Thumper server and the Thumper client. In one console window run thumper_server. In another console window run thumper_client. The server should state that it is connected to the database and then do nothing. In the client, select "fetch timestamp" and then select a file. The client should then fail with an unhandled Program_Error exception and a message of "Client_SPARK_Boundary.Fetch_Timestamp not implemented". This is expected at this time. Note to macOS users: The Thumper client will not build for you because it requires GtkAda, which is not available.
Load the file client/client_timestamp_maker.adb into GNATstudio and try doing a SPARK... Examine File operation. The examination should show a few messages with "high" significance. Those issues will be corrected eventually.
Load the file network-addresses.adb into GNATstudio. This is a package that does translation between textual IP addresses ("155.42.107.97") and their binary representation. Try SPARK... Examine File. The examination should succeed. Try SPARK... Prove File. All proofs should succeed (you might want to set the "level" to "level 2"); the code is free of runtime errors.
In this lab you should not have modified any files. If GitHub Desktop is showing any changes, discard those changes.
This lab is worth 10 points
Last Revised: 2022-02-14
© Copyright 2022 by Peter C. Chapin <pchapin@vtc.edu>