diff --git a/Makefile.am b/Makefile.am index 773ff56..9431c77 100644 --- a/Makefile.am +++ b/Makefile.am @@ -115,7 +115,8 @@ dist_check_SCRIPTS = \ test/functional/pack/test.bats \ test/functional/full-run/test.bats \ test/functional/full-run-delta/test.bats \ - test/functional/file-name-blacklisted/test.bats + test/functional/file-name-blacklisted/test.bats \ + test/functional/state-file/test.bats endif if COVERAGE diff --git a/test/functional/state-file/test.bats b/test/functional/state-file/test.bats new file mode 100755 index 0000000..c0a07bf --- /dev/null +++ b/test/functional/state-file/test.bats @@ -0,0 +1,28 @@ +#!/usr/bin/env bats + +# common functions +load "../swupdlib" + +setup() { + clean_test_dir + init_test_dir + + init_server_ini + set_latest_ver 0 + init_groups_ini os-core + + set_os_release 10 os-core + track_bundle 10 os-core + + gen_file_plain 10 os-core "/var/lib/test" +} + +@test "state file marked in manifest" { + sudo $CREATE_UPDATE --osversion 10 --statedir $DIR --format 3 + + # a file and dir installed in /var should be marked state + grep '^D\.s\..*/var/lib$' $DIR/www/10/Manifest.os-core + grep '^F\.s\..*/var/lib/test$' $DIR/www/10/Manifest.os-core +} + +# vi: ft=sh ts=8 sw=2 sts=2 et tw=80 diff --git a/test/functional/swupdlib.bash b/test/functional/swupdlib.bash index 7119060..1289ec4 100644 --- a/test/functional/swupdlib.bash +++ b/test/functional/swupdlib.bash @@ -91,7 +91,7 @@ gen_file_plain() { local name="$3" # Add plain text file into a bundle - mkdir -p $DIR/image/$ver/$bundle + mkdir -p $DIR/image/$ver/$bundle/$(dirname "$name") echo "$name" > $DIR/image/$ver/$bundle/"$name" } @@ -101,7 +101,7 @@ gen_file_plain_change() { local name="$3" # Add plain text file into a bundle - mkdir -p $DIR/image/$ver/$bundle + mkdir -p $DIR/image/$ver/$bundle/$(dirname "$name") echo "$ver $name" > $DIR/image/$ver/$bundle/"$name" }