+# test monitor_free_space property (testing the monitoring would require a
+# dedicated partition for the tests - it's not worth it)
+
+ok($dev->property_get("monitor_free_space"),
+ "monitor_free_space property is set by default");
+
+ok($dev->property_set("monitor_free_space", 0),
+ "monitor_free_space property can be set to false");
+
+ok(!$dev->property_get("monitor_free_space"),
+ "monitor_free_space property value 'sticks'");
+
+# test the LEOM functionality
+
+$dev = undef;
+$dev = Amanda::Device->new($dev_name);
+is($dev->status(), $DEVICE_STATUS_SUCCESS,
+ "$dev_name: re-create successful")
+ or diag($dev->error_or_status());
+ok($dev->property_set("MAX_VOLUME_USAGE", "512k"),
+ "set MAX_VOLUME_USAGE to test LEOM");
+ok($dev->property_set("LEOM", 1),
+ "set LEOM");
+
+ok($dev->start($ACCESS_WRITE, 'TESTCONF23', undef),
+ "start in write mode")
+ or diag($dev->error_or_status());
+
+ok($dev->start_file($dumpfile),
+ "start file 1")
+ or diag($dev->error_or_status());
+
+ok(!$dev->is_eom,
+ "device does not indicate LEOM before writing");
+
+ok(Amanda::Device::write_random_to_device(0xCAFE, 440*1024, $dev),
+ "write random data into the early-warning zone");
+
+ok($dev->is_eom,
+ "device indicates LEOM after writing");
+
+ok($dev->finish_file(),
+ "..but a finish_file is allowed to complete")
+ or diag($dev->error_or_status());
+
+ok($dev->finish(),
+ "finish device after LEOM test")
+ or diag($dev->error_or_status());
+
+$dev = undef;
+$dev = Amanda::Device->new($dev_name);
+is($dev->status(), $DEVICE_STATUS_SUCCESS,
+ "$dev_name: re-create successful")
+ or diag($dev->error_or_status());
+ok($dev->property_set("MAX_VOLUME_USAGE", "160k"),
+ "set MAX_VOLUME_USAGE to test LEOM while writing the first header");
+ok($dev->property_set("LEOM", 1),
+ "set LEOM");
+
+ok($dev->start($ACCESS_WRITE, 'TESTCONF23', undef),
+ "start in write mode")
+ or diag($dev->error_or_status());
+
+ok($dev->start_file($dumpfile),
+ "start file 1")
+ or diag($dev->error_or_status());
+
+ok($dev->is_eom,
+ "device indicates LEOM after writing first header");
+
+ok($dev->finish_file(),
+ "..but a finish_file is allowed to complete")
+ or diag($dev->error_or_status());
+
+ok($dev->finish(),
+ "finish device after LEOM test")
+ or diag($dev->error_or_status());
+