File: run-unit-test

package info (click to toggle)
nutsqlite 2.0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 764 kB
  • sloc: sh: 5,650; makefile: 2
file content (46 lines) | stat: -rw-r--r-- 1,800 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
set -e

pkg=nutsqlite

export LC_ALL=C.UTF-8
if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
  AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
  # Double quote below to expand the temporary directory variable now versus
  # later is on purpose.
  # shellcheck disable=SC2064
  trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
fi

cd "${AUTOPKGTEST_TMP}"

set -v

###############################################################################
# Testing update-nut
set +e
DISPLAY= update-nut
STATUS=$?
set -e
# The database construction fails with error 1 due to the windowing being
# unavailable, but this is expected; the database should be created anyway.
test "$STATUS" = 1
# Checking update-nut artifacts
test "$(file nut.db     | awk '{print $2, $3, $4}')" = 'SQLite 3.x database,'
# Handle transition to file 5.45, where sqlite shm is recognized as such;
# see #1051083.
readonly NUT_SHM_FILE="$(file nut.db-shm | awk '{print $2, $3, $4, $5, $6}')"
test "$NUT_SHM_FILE" = 'SQLite Write-Ahead Log shared memory,' \
|| test "$NUT_SHM_FILE" = 'data    '
test "$(file nut.db-wal | awk '{print $2, $3, $4}')" = 'SQLite Write-Ahead Log,'

###############################################################################
# NOTE: to remove the "superficial" marker, it would be nice to have a test of
# the "nut" program, but this would require the USDA food Standard Reference,
# which seems to be packageable, under CC0-1.0 license:
#
# 	https://data.nal.usda.gov/dataset/composition-foods-raw-processed-prepared-usda-national-nutrient-database-standard-reference-release-28-0
#
# In addition, it would require a running X server and a record of a session
# clicking around, using "cnee" for instance.
###############################################################################